mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-30 23:16:52 +00:00
feature:
简化层级
This commit is contained in:
@@ -12,7 +12,7 @@ const DarkModeButton = () => {
|
|||||||
changeTheme(newTheme)
|
changeTheme(newTheme)
|
||||||
}
|
}
|
||||||
return <div className='z-10 duration-200 text-xl cursor-pointer'>
|
return <div className='z-10 duration-200 text-xl cursor-pointer'>
|
||||||
<FontAwesomeIcon icon={userTheme === 'dark' ? faSun : faMoon} id='darkModeButton' className='fa mx-2.5 my-2 hover:scale-125 transform duration-200'
|
<FontAwesomeIcon icon={userTheme === 'dark' ? faSun : faMoon} id='darkModeButton' className='mx-2 my-2 hover:scale-125 transform duration-200'
|
||||||
onClick={handleChangeDarkMode} />
|
onClick={handleChangeDarkMode} />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ const JumpToTopButton = ({ targetRef, showPercent = true }) => {
|
|||||||
<div className='w-10 text-xl dark:text-gray-100 transform hover:scale-125 duration-200' title={locale.POST.TOP} >
|
<div className='w-10 text-xl dark:text-gray-100 transform hover:scale-125 duration-200' title={locale.POST.TOP} >
|
||||||
<FontAwesomeIcon icon={faArrowUp} />
|
<FontAwesomeIcon icon={faArrowUp} />
|
||||||
</div>
|
</div>
|
||||||
{showPercent && (<div className='w-10 text-xs dark:text-gray-200'>{percent} </div>)}
|
{showPercent && (<div className='w-10 text-xs dark:text-gray-200'>{percent}</div>)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>)
|
</div>)
|
||||||
|
|||||||
@@ -26,20 +26,16 @@ import { faAngleDoubleRight, faArchive, faTags, faThList } from '@fortawesome/fr
|
|||||||
const SideBar = ({ tags, currentTag, post, posts, categories, currentCategory, currentSearch }) => {
|
const SideBar = ({ tags, currentTag, post, posts, categories, currentCategory, currentSearch }) => {
|
||||||
const { locale } = useGlobal()
|
const { locale } = useGlobal()
|
||||||
return <aside id='sidebar' className='pt-10 bg-white dark:bg-gray-900 w-72 z-10 dark:border-gray-500 border-gray-200 scroll-hidden h-full'>
|
return <aside id='sidebar' className='pt-10 bg-white dark:bg-gray-900 w-72 z-10 dark:border-gray-500 border-gray-200 scroll-hidden h-full'>
|
||||||
<section>
|
<InfoCard />
|
||||||
<InfoCard />
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<div className={(!post ? 'sticky top-0' : '') + ' bg-white dark:bg-gray-900 pb-4'}>
|
<div className={(!post ? 'sticky top-0' : '') + ' bg-white dark:bg-gray-900 pb-4'}>
|
||||||
|
|
||||||
<section>
|
|
||||||
{/* <hr className='dark:border-gray-700' /> */}
|
{/* <hr className='dark:border-gray-700' /> */}
|
||||||
<MenuButtonGroup allowCollapse={true} />
|
<MenuButtonGroup allowCollapse={true} />
|
||||||
<section className='p-5'>
|
<section className='p-5'>
|
||||||
<SearchInput currentTag={currentTag} currentSearch={currentSearch} />
|
<SearchInput currentTag={currentTag} currentSearch={currentSearch} />
|
||||||
</section>
|
</section>
|
||||||
<hr className='dark:border-gray-700' />
|
<hr className='dark:border-gray-700' />
|
||||||
</section>
|
|
||||||
|
|
||||||
{/* 最新文章 */}
|
{/* 最新文章 */}
|
||||||
{posts && (
|
{posts && (
|
||||||
@@ -85,17 +81,15 @@ const SideBar = ({ tags, currentTag, post, posts, categories, currentCategory, c
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{post && (
|
{post && (
|
||||||
<section id='left-toc' className='sticky top-0 bg-white dark:bg-gray-800'>
|
<section id='left-toc' className='sticky pb-20 top-0 bg-white dark:bg-gray-800'>
|
||||||
<div
|
<div className='border-b text-2xl bg-white font-bold text-black dark:border-gray-700 dark:bg-gray-700 dark:text-white py-6 px-6'>
|
||||||
className='border-b text-2xl bg-white font-bold text-black dark:border-gray-700 dark:bg-gray-700 dark:text-white py-6 px-6'>
|
|
||||||
{locale.COMMON.TABLE_OF_CONTENTS}
|
{locale.COMMON.TABLE_OF_CONTENTS}
|
||||||
</div>
|
</div>
|
||||||
<Toc toc={post.toc} />
|
<Toc toc={post.toc} />
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<section id='blank' className='bg-white dark:bg-gray-900 py-20' />
|
{/* <section id='blank' className='bg-white dark:bg-gray-900 py-20' /> */}
|
||||||
|
|
||||||
</aside>
|
</aside>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,14 +18,14 @@ const SideBarDrawer = ({ post, currentTag, cRef, tags, posts, categories, curren
|
|||||||
const switchSideDrawerVisible = () => {
|
const switchSideDrawerVisible = () => {
|
||||||
changeHiddenStatus(!isHidden)
|
changeHiddenStatus(!isHidden)
|
||||||
}
|
}
|
||||||
return <div>
|
return <>
|
||||||
<div className={(isHidden ? '-ml-72' : 'shadow-2xl') + ' flex flex-col duration-300 fixed h-full left-0 overflow-y-scroll scroll-hidden top-0 z-50'}>
|
<div className={(isHidden ? '-ml-72' : 'shadow-2xl') + ' flex flex-col duration-300 fixed h-full left-0 overflow-y-scroll scroll-hidden top-0 z-50'}>
|
||||||
<SideBar tags={tags} post={post} posts={posts} categories={categories} currentCategory={currentCategory} />
|
<SideBar tags={tags} post={post} posts={posts} categories={categories} currentCategory={currentCategory} />
|
||||||
</div>
|
</div>
|
||||||
{/* 背景蒙版 */}
|
{/* 背景蒙版 */}
|
||||||
<div id='drawer-background'
|
<div id='sidebar-drawer-background'
|
||||||
className={(isHidden ? 'hidden' : 'block') + ' fixed top-0 left-0 z-30 w-full h-full bg-black bg-opacity-30'}
|
className={(isHidden ? 'hidden' : 'block') + ' fixed top-0 left-0 z-30 w-full h-full bg-black bg-opacity-30'}
|
||||||
onClick={switchSideDrawerVisible} />
|
onClick={switchSideDrawerVisible} />
|
||||||
</div>
|
</>
|
||||||
}
|
}
|
||||||
export default SideBarDrawer
|
export default SideBarDrawer
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { useRef } from 'react'
|
import { useRef } from 'react'
|
||||||
import DarkModeButton from '@/components/DarkModeButton'
|
import DarkModeButton from '@/components/DarkModeButton'
|
||||||
import SearchInput from '@/components/SearchInput'
|
|
||||||
import SideBarDrawer from '@/components/SideBarDrawer'
|
import SideBarDrawer from '@/components/SideBarDrawer'
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||||
import { faBars } from '@fortawesome/free-solid-svg-icons'
|
import { faBars } from '@fortawesome/free-solid-svg-icons'
|
||||||
|
import BLOG from '@/blog.config'
|
||||||
|
|
||||||
const TopNav = ({ tags, currentTag, post, posts, currentSearch, categories, currentCategory }) => {
|
const TopNav = ({ tags, currentTag, post, posts, currentSearch, categories, currentCategory }) => {
|
||||||
const drawer = useRef()
|
const drawer = useRef()
|
||||||
|
|
||||||
return (<>
|
return (<div id='top-nav' className='block lg:hidden'>
|
||||||
{/* 侧面抽屉 */}
|
{/* 侧面抽屉 */}
|
||||||
<SideBarDrawer post={post} currentTag={currentTag} cRef={drawer} tags={tags} posts={posts} categories={categories} currentCategory={currentCategory}/>
|
<SideBarDrawer post={post} currentTag={currentTag} cRef={drawer} tags={tags} posts={posts} categories={categories} currentCategory={currentCategory}/>
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ const TopNav = ({ tags, currentTag, post, posts, currentSearch, categories, curr
|
|||||||
{/* 左侧LOGO */}
|
{/* 左侧LOGO */}
|
||||||
<div className='flex ml-12'>
|
<div className='flex ml-12'>
|
||||||
<div onClick={() => { drawer.current.handleSwitchSideDrawerVisible() }}
|
<div onClick={() => { drawer.current.handleSwitchSideDrawerVisible() }}
|
||||||
className='fixed top-3 left-0 z-30 py-1 px-5 text-gray-600 text-2xl cursor-pointer dark:text-gray-300'>
|
className='fixed top-3 left-0 z-30 ml-5 text-gray-600 text-2xl cursor-pointer dark:text-gray-300'>
|
||||||
<FontAwesomeIcon icon={faBars} className='hover:scale-125 transform duration-200'
|
<FontAwesomeIcon icon={faBars} className='hover:scale-125 transform duration-200'
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -26,7 +26,7 @@ const TopNav = ({ tags, currentTag, post, posts, currentSearch, categories, curr
|
|||||||
|
|
||||||
{/* 中间搜索框 */}
|
{/* 中间搜索框 */}
|
||||||
<div className='w-96'>
|
<div className='w-96'>
|
||||||
<SearchInput currentTag={currentTag} currentSearch={currentSearch}/>
|
<span className='text-lg dark:text-gray-200'>{BLOG.title}</span> | <span className='dark:text-gray-300'>{BLOG.description}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 右侧功能 */}
|
{/* 右侧功能 */}
|
||||||
@@ -36,7 +36,7 @@ const TopNav = ({ tags, currentTag, post, posts, currentSearch, categories, curr
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</>)
|
</div>)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default TopNav
|
export default TopNav
|
||||||
|
|||||||
@@ -69,27 +69,25 @@ const BaseLayout = ({
|
|||||||
<CommonHead meta={meta} />
|
<CommonHead meta={meta} />
|
||||||
|
|
||||||
{/* 顶部导航栏 */}
|
{/* 顶部导航栏 */}
|
||||||
<div className='block lg:hidden'>
|
<TopNav tags={tags} post={post} posts={totalPosts} currentSearch={currentSearch} categories={categories} currentCategory={currentCategory} />
|
||||||
<TopNav tags={tags} post={post} posts={totalPosts} currentSearch={currentSearch} categories={categories}
|
|
||||||
currentCategory={currentCategory} />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Middle Wrapper */}
|
{/* Middle Wrapper */}
|
||||||
<main className='flex dark:bg-black'>
|
<div className='flex dark:bg-black'>
|
||||||
<div className='hidden lg:block z-10'>
|
<div className='hidden lg:block z-10'>
|
||||||
<SideBar post={post} posts={totalPosts} tags={tags} currentSearch={currentSearch} currentTag={currentTag} categories={categories} currentCategory={currentCategory} />
|
<SideBar post={post} posts={totalPosts} tags={tags} currentSearch={currentSearch} currentTag={currentTag} categories={categories} currentCategory={currentCategory} />
|
||||||
</div>
|
</div>
|
||||||
<div className='flex flex-grow' ref={targetRef}>
|
<div className='flex flex-grow' ref={targetRef}>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
<JumpToTopButton targetRef={targetRef} showPercent={true} />
|
</div>
|
||||||
<div className='hidden lg:block fixed right-1 bottom-52 p-1
|
|
||||||
bg-white text-black shadow-card dark:border-gray-500 dark:bg-gray-700 dark:text-white'>
|
|
||||||
<DarkModeButton />
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<Footer />
|
<Footer />
|
||||||
|
|
||||||
|
<JumpToTopButton targetRef={targetRef} showPercent={true} />
|
||||||
|
<div className='hidden lg:block fixed right-1 bottom-52 py-1 px-1.5
|
||||||
|
bg-white text-black shadow-card dark:border-gray-500 dark:bg-gray-700 dark:text-white'>
|
||||||
|
<DarkModeButton />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,20 +51,20 @@ const ArticleDetail = ({ post, blockMap, tags, prev, next, allPosts, categories
|
|||||||
return <BaseLayout meta={meta} tags={tags} post={post} totalPosts={allPosts} categories={categories}>
|
return <BaseLayout meta={meta} tags={tags} post={post} totalPosts={allPosts} categories={categories}>
|
||||||
<Progress targetRef={targetRef} />
|
<Progress targetRef={targetRef} />
|
||||||
|
|
||||||
<article id='article-wrapper' ref={targetRef} className='flex-grow dark:bg-black pt-16 bg-gray-200'>
|
<div id='article-wrapper' ref={targetRef} className='flex-grow dark:bg-black bg-gray-200'>
|
||||||
|
|
||||||
<div className='max-w-5xl mx-auto'>
|
<div className='max-w-5xl mx-auto mt-16 xl:mt-32 w-screen md:w-full '>
|
||||||
<div className='w-screen md:w-full pt-10 '>
|
{post.type && !post.type.includes('Page') && (<>
|
||||||
{post.type && !post.type.includes('Page') && (<div className='w-full h-60 lg:h-96 transform duration-200 md:flex-shrink-0'>
|
<header className='w-full h-60 lg:h-96 transform duration-200 md:flex-shrink-0'>
|
||||||
<Image src={(post.page_cover && post.page_cover.length > 1) ? post.page_cover : BLOG.defaultImgCover} loading='lazy' objectFit='cover' layout='fill' alt={post.title} />
|
<Image src={(post.page_cover && post.page_cover.length > 1) ? post.page_cover : BLOG.defaultImgCover} loading='lazy' objectFit='cover' layout='fill' alt={post.title} />
|
||||||
</div>)}
|
</header>
|
||||||
</div>
|
</>)}
|
||||||
|
|
||||||
<div className='animate__fadeIn animate__animated subpixel-antialiased w-screen md:w-full lg:pt-32 lg:px-44 px-5 py-2 dark:border-gray-700 bg-white dark:bg-gray-800'>
|
<article className='animate__fadeIn animate__animated subpixel-antialiased lg:pt-32 lg:px-44 px-5 py-2 dark:border-gray-700 bg-white dark:bg-gray-800'>
|
||||||
{/* 文章Title */}
|
{/* 文章Title */}
|
||||||
<h1 className='font-bold text-3xl pt-5 text-black dark:text-white italic'> {post.title}</h1>
|
<h1 className='font-bold text-3xl pt-5 text-black dark:text-white italic'> {post.title}</h1>
|
||||||
<hr className='mt-4' />
|
<hr className='mt-4' />
|
||||||
<div className='flex-nowrap flex mt-1 dark:text-white'>
|
<section className='flex-nowrap flex mt-1 dark:text-white'>
|
||||||
<Link href={`/category/${post.category}`} passHref>
|
<Link href={`/category/${post.category}`} passHref>
|
||||||
<div className='cursor-pointer text-md py-2 ml-1 mr-3 text-gray-500 dark:text-gray-300 hover:text-black dark:hover:text-white'>
|
<div className='cursor-pointer text-md py-2 ml-1 mr-3 text-gray-500 dark:text-gray-300 hover:text-black dark:hover:text-white'>
|
||||||
<FontAwesomeIcon icon={faFolderOpen} className='mr-1' />{post.category}
|
<FontAwesomeIcon icon={faFolderOpen} className='mr-1' />{post.category}
|
||||||
@@ -86,7 +86,7 @@ const ArticleDetail = ({ post, blockMap, tags, prev, next, allPosts, categories
|
|||||||
<FontAwesomeIcon icon={faEye} className='text-gray-500 dark:text-gray-400 mt-3 ml-2' />
|
<FontAwesomeIcon icon={faEye} className='text-gray-500 dark:text-gray-400 mt-3 ml-2' />
|
||||||
<span id='busuanzi_value_page_pv' className='text-gray-500 dark:text-gray-400 leading-6'></span>
|
<span id='busuanzi_value_page_pv' className='text-gray-500 dark:text-gray-400 leading-6'></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</section>
|
||||||
|
|
||||||
{/* Notion文章主体 */}
|
{/* Notion文章主体 */}
|
||||||
{blockMap && (
|
{blockMap && (
|
||||||
@@ -127,7 +127,7 @@ const ArticleDetail = ({ post, blockMap, tags, prev, next, allPosts, categories
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</div>
|
</article>
|
||||||
|
|
||||||
<div className='w-screen md:w-full px-5 py-2 dark:border-gray-700 bg-white dark:bg-gray-800'>
|
<div className='w-screen md:w-full px-5 py-2 dark:border-gray-700 bg-white dark:bg-gray-800'>
|
||||||
<div className='py-10'>
|
<div className='py-10'>
|
||||||
@@ -154,7 +154,7 @@ const ArticleDetail = ({ post, blockMap, tags, prev, next, allPosts, categories
|
|||||||
<Comment frontMatter={post} />
|
<Comment frontMatter={post} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</div>
|
||||||
|
|
||||||
{/* 悬浮目录按钮 */}
|
{/* 悬浮目录按钮 */}
|
||||||
<div className='block lg:hidden'>
|
<div className='block lg:hidden'>
|
||||||
|
|||||||
Reference in New Issue
Block a user