mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-07 15:10:32 +00:00
💅 微调 样式
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
import BLOG from '@/blog.config'
|
import BLOG from '@/blog.config'
|
||||||
import dynamic from 'next/dynamic'
|
import dynamic from 'next/dynamic'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
|
import { useTheme } from '@/lib/theme'
|
||||||
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
const GitalkComponent = dynamic(
|
const GitalkComponent = dynamic(
|
||||||
() => {
|
() => {
|
||||||
@@ -23,6 +25,7 @@ const CusdisComponent = dynamic(
|
|||||||
|
|
||||||
const Comment = ({ frontMatter }) => {
|
const Comment = ({ frontMatter }) => {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const { theme } = useTheme()
|
||||||
|
|
||||||
return <div className='comment text-gray-800 dark:text-gray-300'>
|
return <div className='comment text-gray-800 dark:text-gray-300'>
|
||||||
<div className='font-bold pt-2 pb-4 '>留下评论</div>
|
<div className='font-bold pt-2 pb-4 '>留下评论</div>
|
||||||
@@ -55,7 +58,7 @@ const Comment = ({ frontMatter }) => {
|
|||||||
pageId: frontMatter.id,
|
pageId: frontMatter.id,
|
||||||
pageTitle: frontMatter.title,
|
pageTitle: frontMatter.title,
|
||||||
pageUrl: BLOG.link + router.asPath,
|
pageUrl: BLOG.link + router.asPath,
|
||||||
theme: BLOG.appearance
|
theme: theme
|
||||||
}}
|
}}
|
||||||
lang={BLOG.lang.toLowerCase()}
|
lang={BLOG.lang.toLowerCase()}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const DarkModeButton = () => {
|
|||||||
changeTheme(newTheme)
|
changeTheme(newTheme)
|
||||||
localStorage.setItem('theme', newTheme)
|
localStorage.setItem('theme', newTheme)
|
||||||
}
|
}
|
||||||
return <div className='p-1 border dark:border-gray-500 my-4 bg-white dark:bg-gray-600 dark:bg-opacity-70 bg-opacity-70 dark:hover:bg-gray-100 text-xl cursor-pointer dark:text-gray-300 dark:hover:text-black'>
|
return <div className='z-10 p-1 border dark:border-gray-500 mr-2 h-12 my-2 bg-white dark:bg-gray-600 dark:bg-opacity-70 bg-opacity-70 dark:hover:bg-gray-100 text-xl cursor-pointer dark:text-gray-300 dark:hover:text-black'>
|
||||||
<i className={'fa p-2.5 hover:scale-125 transform duration-200 ' + (theme === 'dark' ? ' fa-sun-o' : ' fa-moon-o') } onClick={handleChangeDarkMode} />
|
<i className={'fa p-2.5 hover:scale-125 transform duration-200 ' + (theme === 'dark' ? ' fa-sun-o' : ' fa-moon-o') } onClick={handleChangeDarkMode} />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,17 +22,15 @@ const RightAside = ({ toc, post }) => {
|
|||||||
changeHideAside(true)
|
changeHideAside(true)
|
||||||
}
|
}
|
||||||
}, 500)
|
}, 500)
|
||||||
const [hideAside, changeHideAside] = useState(false)
|
const [hideAside, changeHideAside] = useState(true)
|
||||||
|
|
||||||
return <aside className='bg-white dark:bg-gray-800 py-5'>
|
return <aside className='bg-white dark:bg-gray-800 py-5'>
|
||||||
<div className={(hideAside ? 'w-0' : 'w-52') + ' duration-500'} />
|
|
||||||
|
|
||||||
{/* 上方菜单组 */}
|
{/* 上方菜单组 */}
|
||||||
<div
|
<div
|
||||||
className={(hideAside ? 'right-0' : 'right-52') + ' space-x-2 fixed md:fixed flex top-0 px-4 py-1 duration-500'}>
|
className={(hideAside ? 'right-0' : 'right-48') + ' z-20 space-x-2 fixed flex top-0 px-3 py-1 duration-500'}>
|
||||||
{/* 目录按钮 */}
|
{/* 目录按钮 */}
|
||||||
<div
|
<div
|
||||||
className='border dark:border-gray-500 my-3 bg-white dark:bg-gray-600 bg-opacity-70 dark:hover:bg-gray-100 text-xl cursor-pointer dark:text-gray-300 dark:hover:text-black p-1'>
|
className='border dark:border-gray-500 my-2 bg-white dark:bg-gray-600 bg-opacity-70 dark:hover:bg-gray-100 text-xl cursor-pointer dark:text-gray-300 dark:hover:text-black p-1'>
|
||||||
<i className='fa fa-book p-2.5 hover:scale-125 transform duration-200'
|
<i className='fa fa-book p-2.5 hover:scale-125 transform duration-200'
|
||||||
onClick={() => changeHideAside(!hideAside)} />
|
onClick={() => changeHideAside(!hideAside)} />
|
||||||
</div>
|
</div>
|
||||||
@@ -40,7 +38,7 @@ const RightAside = ({ toc, post }) => {
|
|||||||
|
|
||||||
{/* 下方菜单组 */}
|
{/* 下方菜单组 */}
|
||||||
<div
|
<div
|
||||||
className={(hideAside ? 'right-0' : 'right-52') + ' space-x-2 fixed flex bottom-10 px-4 py-1 duration-500'}>
|
className={(hideAside ? 'right-0' : 'right-48') + ' space-x-2 fixed flex bottom-10 px-4 py-1 duration-500'}>
|
||||||
<div className='flex-wrap'>
|
<div className='flex-wrap'>
|
||||||
{/* 分享按钮 */}
|
{/* 分享按钮 */}
|
||||||
<ShareButton post={post} />
|
<ShareButton post={post} />
|
||||||
@@ -51,7 +49,7 @@ const RightAside = ({ toc, post }) => {
|
|||||||
|
|
||||||
{/* 目录 */}
|
{/* 目录 */}
|
||||||
<div
|
<div
|
||||||
className={(hideAside ? '-mr-52' : 'mr-0 shadow-xl xl:shadow-none') + ' h-full hover:shadow-2xl bg-white w-52 right-0 dark:bg-gray-800 duration-500 fixed top-0 pt-8'}>
|
className={(hideAside ? '-mr-48' : 'mr-0 shadow-xl xl:shadow-none') + ' fixed h-full hover:shadow-2xl bg-white w-48 right-0 dark:bg-gray-800 duration-500 top-0 pt-8'}>
|
||||||
<TocBar toc={toc} />
|
<TocBar toc={toc} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ const SideBar = ({ tags, currentTag }) => {
|
|||||||
|
|
||||||
<div className={(collapse ? '-ml-80 ' : 'shadow-2xl xl:shadow-none') + ' hover:shadow-2xl dark:bg-gray-800 bg-white sidebar h-full w-60 duration-500 ease-in-out'}>
|
<div className={(collapse ? '-ml-80 ' : 'shadow-2xl xl:shadow-none') + ' hover:shadow-2xl dark:bg-gray-800 bg-white sidebar h-full w-60 duration-500 ease-in-out'}>
|
||||||
|
|
||||||
|
{/* Logo */}
|
||||||
<section className='mx-5 pt-6 pb-2 border-b'>
|
<section className='mx-5 pt-6 pb-2 border-b'>
|
||||||
<Link href='/'>
|
<Link href='/'>
|
||||||
<a
|
<a
|
||||||
@@ -48,6 +49,7 @@ const SideBar = ({ tags, currentTag }) => {
|
|||||||
</Link>
|
</Link>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
{/* 地理标志 */}
|
||||||
<section className='text-gray-500 text-sm px-7 pt-3 pb-5 dark:text-gray-300'>
|
<section className='text-gray-500 text-sm px-7 pt-3 pb-5 dark:text-gray-300'>
|
||||||
<i className='fa fa-map-marker mr-1' />
|
<i className='fa fa-map-marker mr-1' />
|
||||||
Fuzhou, China
|
Fuzhou, China
|
||||||
@@ -69,6 +71,7 @@ const SideBar = ({ tags, currentTag }) => {
|
|||||||
<i className='fa fa-search text-gray-400 -ml-8' />
|
<i className='fa fa-search text-gray-400 -ml-8' />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* 标签云 */}
|
||||||
<div className='p-6'>
|
<div className='p-6'>
|
||||||
<div className='mb-3'>
|
<div className='mb-3'>
|
||||||
<span className='text-xl border-b-2 text-gray-500 dark:text-gray-400'>标签</span>
|
<span className='text-xl border-b-2 text-gray-500 dark:text-gray-400'>标签</span>
|
||||||
@@ -76,6 +79,7 @@ const SideBar = ({ tags, currentTag }) => {
|
|||||||
<Tags tags={tags} currentTag={currentTag} />
|
<Tags tags={tags} currentTag={currentTag} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* 菜单 */}
|
||||||
<div className='p-6'>
|
<div className='p-6'>
|
||||||
<div className='mb-3'>
|
<div className='mb-3'>
|
||||||
<span className='text-xl border-b-2 text-gray-500 dark:text-gray-400'>菜单</span>
|
<span className='text-xl border-b-2 text-gray-500 dark:text-gray-400'>菜单</span>
|
||||||
@@ -88,15 +92,16 @@ const SideBar = ({ tags, currentTag }) => {
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* 站点信息 */}
|
||||||
<Footer />
|
<Footer />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 顶部菜单按钮 */}
|
{/* 顶部菜单按钮 */}
|
||||||
<div
|
<div
|
||||||
className={(collapse ? 'left-0' : 'left-60') + ' fixed flex-wrap top-0 px-4 py-1 duration-500 ease-in-out'}>
|
className={(collapse ? 'left-0' : 'left-60') + ' fixed flex flex-nowrap md:flex-col top-0 pl-4 py-1 duration-500 ease-in-out'}>
|
||||||
{/* 菜单折叠 */}
|
{/* 菜单折叠 */}
|
||||||
<div className='p-1 border dark:border-gray-500 my-3 bg-white dark:bg-gray-600 dark:bg-opacity-70 bg-opacity-70
|
<div className='z-30 p-1 border dark:border-gray-500 h-12 bg-white dark:bg-gray-600 dark:bg-opacity-70 bg-opacity-70
|
||||||
dark:hover:bg-gray-100 text-xl cursor-pointer dark:text-gray-300 dark:hover:text-black'>
|
dark:hover:bg-gray-100 text-xl cursor-pointer mr-2 my-2 dark:text-gray-300 dark:hover:text-black'>
|
||||||
<i className='fa fa-bars p-2.5 hover:scale-125 transform duration-200' onClick={() => changeCollapse(!collapse)} />
|
<i className='fa fa-bars p-2.5 hover:scale-125 transform duration-200' onClick={() => changeCollapse(!collapse)} />
|
||||||
</div>
|
</div>
|
||||||
{/* 夜间模式 */}
|
{/* 夜间模式 */}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ const ArticleLayout = ({
|
|||||||
{/* 中央区域 wrapper */}
|
{/* 中央区域 wrapper */}
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<header className='border-l border-t border-r mx-auto max-w-5xl mt-20 md:flex-shrink-0 overflow-y-hidden animate__fadeIn animate__animated'>
|
<header className='mx-auto max-w-5xl mt-20 md:flex-shrink-0 overflow-y-hidden animate__fadeIn animate__animated'>
|
||||||
{/* 封面图 */}
|
{/* 封面图 */}
|
||||||
{frontMatter.page_cover && frontMatter.page_cover.length > 1 && (
|
{frontMatter.page_cover && frontMatter.page_cover.length > 1 && (
|
||||||
<img className='bg-center object-cover w-full' style={{ maxHeight: '40rem' }}
|
<img className='bg-center object-cover w-full' style={{ maxHeight: '40rem' }}
|
||||||
|
|||||||
Reference in New Issue
Block a user