mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-29 15:10:06 +00:00
调试模式
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import CommonHead from '@/components/CommonHead'
|
||||
import Link from 'next/link'
|
||||
|
||||
/**
|
||||
* 基础布局 采用左右两侧布局,移动端使用顶部导航栏
|
||||
@@ -6,14 +7,31 @@ import CommonHead from '@/components/CommonHead'
|
||||
* @returns {JSX.Element}
|
||||
* @constructor
|
||||
*/
|
||||
const LayoutBase = (props) => {
|
||||
const LayoutBase = props => {
|
||||
const { children, meta } = props
|
||||
return <div>
|
||||
<CommonHead meta={meta} />
|
||||
<main id='wrapper' className='flex justify-center flex-1 pb-12'>
|
||||
{children}
|
||||
</main>
|
||||
</div>
|
||||
return (
|
||||
<div>
|
||||
<CommonHead meta={meta} />
|
||||
{/* 导航菜单 */}
|
||||
<div className="w-full flex justify-center my-2">
|
||||
<nav className="max-w-6xl space-x-3 underline">
|
||||
<Link href="/">
|
||||
<a>首页</a>
|
||||
</Link>
|
||||
<Link href="/category">
|
||||
<a>分类</a>
|
||||
</Link>
|
||||
<Link href="/tag">
|
||||
<a>标签</a>
|
||||
</Link>
|
||||
</nav>
|
||||
</div>
|
||||
{/* 内容主体 */}
|
||||
<main id="wrapper" className="flex justify-center flex-1 pb-12">
|
||||
<div className="max-w-6xl">{children}</div>
|
||||
</main>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default LayoutBase
|
||||
|
||||
@@ -1,6 +1,19 @@
|
||||
import Link from 'next/link'
|
||||
import LayoutBase from './LayoutBase'
|
||||
|
||||
export const LayoutIndex = (props) => {
|
||||
// const { posts, tags, meta, categories, postCount, latestPosts } = props
|
||||
return <LayoutBase {...props}>Index</LayoutBase>
|
||||
export const LayoutIndex = props => {
|
||||
const { posts } = props
|
||||
return (
|
||||
<LayoutBase {...props}>
|
||||
Index
|
||||
{posts.map(p => (
|
||||
<div key={p.id} className='border my-12'>
|
||||
<Link href={`/article/${p.slug}`}>
|
||||
<a className='underline cursor-pointer'>{p.title}</a>
|
||||
</Link>
|
||||
<div>{p.summary}</div>
|
||||
</div>
|
||||
))}
|
||||
</LayoutBase>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -6,14 +6,20 @@ import 'prismjs/components/prism-javascript'
|
||||
import 'prismjs/components/prism-markup'
|
||||
import 'prismjs/components/prism-python'
|
||||
import 'prismjs/components/prism-typescript'
|
||||
import { Code, Collection, CollectionRow, Equation, NotionRenderer } from 'react-notion-x'
|
||||
import {
|
||||
Code,
|
||||
Collection,
|
||||
CollectionRow,
|
||||
Equation,
|
||||
NotionRenderer
|
||||
} from 'react-notion-x'
|
||||
import LayoutBase from './LayoutBase'
|
||||
|
||||
const mapPageUrl = id => {
|
||||
return 'https://www.notion.so/' + id.replace(/-/g, '')
|
||||
}
|
||||
|
||||
export const LayoutSlug = (props) => {
|
||||
export const LayoutSlug = props => {
|
||||
const { post } = props
|
||||
const meta = {
|
||||
title: `${post.title} | ${BLOG.TITLE}`,
|
||||
@@ -27,25 +33,27 @@ export const LayoutSlug = (props) => {
|
||||
post.toc = getPageTableOfContents(post, post.blockMap)
|
||||
}
|
||||
|
||||
return <LayoutBase {...props} meta={meta}>
|
||||
<h1>Slug - {post?.title}</h1>
|
||||
<p>
|
||||
{/* Notion文章主体 */}
|
||||
<section id='notion-article' className='px-1'>
|
||||
{post.blockMap && (
|
||||
<NotionRenderer
|
||||
recordMap={post.blockMap}
|
||||
mapPageUrl={mapPageUrl}
|
||||
components={{
|
||||
equation: Equation,
|
||||
code: Code,
|
||||
collectionRow: CollectionRow,
|
||||
collection: Collection
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</section>
|
||||
</p>
|
||||
|
||||
</LayoutBase>
|
||||
return (
|
||||
<LayoutBase {...props} meta={meta}>
|
||||
<div>
|
||||
<h2>{post?.title}</h2>
|
||||
<p>
|
||||
<section id="notion-article" className="px-1">
|
||||
{post.blockMap && (
|
||||
<NotionRenderer
|
||||
recordMap={post.blockMap}
|
||||
mapPageUrl={mapPageUrl}
|
||||
components={{
|
||||
equation: Equation,
|
||||
code: Code,
|
||||
collectionRow: CollectionRow,
|
||||
collection: Collection
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</section>
|
||||
</p>
|
||||
</div>
|
||||
</LayoutBase>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ const SearchDrawer = ({ cRef, slot }) => {
|
||||
})
|
||||
return (
|
||||
<div id='search-drawer-wrapper' ref={searchDrawer} className='hidden'>
|
||||
<div className='flex-col fixed px-5 w-full left-0 top-14 z-50 justify-center'>
|
||||
<div className='flex-col fixed px-5 w-full left-0 top-14 z-40 justify-center'>
|
||||
<div className='md:max-w-3xl w-full mx-auto animate__animated animate__faster animate__fadeIn'>
|
||||
<SearchInput cRef={searchInputRef} />
|
||||
{slot}
|
||||
|
||||
@@ -11,7 +11,7 @@ export default function TopNavBar (props) {
|
||||
const { className, customNav } = props
|
||||
const router = useRouter()
|
||||
|
||||
return <div id='top-nav' className={'sticky top-0 lg:relative w-full z-50 ' + className}>
|
||||
return <div id='top-nav' className={'sticky top-0 lg:relative w-full z-40 ' + className}>
|
||||
<div className='flex w-full h-12 shadow bg-white dark:bg-gray-900 px-5 items-between'>
|
||||
<LogoBar />
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ const SearchDrawer = ({ cRef, slot }) => {
|
||||
})
|
||||
return (
|
||||
<div id='search-drawer-wrapper' ref={searchDrawer} className='hidden'>
|
||||
<div className='flex-col fixed px-5 w-full left-0 top-14 z-50 justify-center'>
|
||||
<div className='flex-col fixed px-5 w-full left-0 top-14 z-40 justify-center'>
|
||||
<div className='md:max-w-3xl w-full mx-auto animate__animated animate__faster animate__fadeIn'>
|
||||
<SearchInput cRef={searchInputRef} />
|
||||
{slot}
|
||||
|
||||
@@ -58,7 +58,7 @@ const ShareBar = ({ post }) => {
|
||||
<a className='text-green-600' ref={btnRef} onMouseEnter={openPopover} onMouseLeave={closePopover}>
|
||||
<i className='fab fa-weixin'/>
|
||||
<div ref={popoverRef} className={(qrCodeShow ? 'animate__animated animate__fadeIn ' : 'hidden') + ' text-center py-2'}>
|
||||
<div className='p-2 bg-white border-0 duration-200 transform block z-50 font-normal shadow-xl mr-10'>
|
||||
<div className='p-2 bg-white border-0 duration-200 transform block z-40 font-normal shadow-xl mr-10'>
|
||||
<QRCode value={shareUrl} fgColor='#000000' />
|
||||
</div>
|
||||
<span className='bg-white text-black font-semibold p-1 mb-0 rounded-t-lg text-sm mx-auto mr-10'>
|
||||
|
||||
@@ -48,7 +48,7 @@ const SideBarDrawer = ({ post, cRef, tags, slot, categories, currentCategory })
|
||||
}
|
||||
|
||||
return <div id='sidebar-wrapper' className='hidden'>
|
||||
<div id='sidebar-drawer' className='-ml-80 bg-white dark:bg-gray-900 flex flex-col duration-300 fixed h-full left-0 overflow-y-scroll scroll-hidden top-0 z-50'>
|
||||
<div id='sidebar-drawer' className='-ml-80 bg-white dark:bg-gray-900 flex flex-col duration-300 fixed h-full left-0 overflow-y-scroll scroll-hidden top-0 z-40'>
|
||||
<SideBar tags={tags} post={post} slot={slot} categories={categories} currentCategory={currentCategory} />
|
||||
</div>
|
||||
{/* 背景蒙版 */}
|
||||
|
||||
Reference in New Issue
Block a user