diff --git a/blog.config.js b/blog.config.js index 059ad0a9..f4c9ab67 100644 --- a/blog.config.js +++ b/blog.config.js @@ -38,8 +38,8 @@ const BLOG = { showPet: false, // 是否显示宠物挂件 petLink: 'https://cdn.jsdelivr.net/npm/live2d-widget-model-wanko@1.0.5/assets/wanko.model.json', // 挂件模型地址 @see https://github.com/xiazeyu/live2d-widget-models showToTop: true, // 是否显示回顶 - showToBottom: true, // 显示回底 - showDarkMode: true, // 显示日间/夜间模式切换 + showToBottom: false, // 显示回底 + showDarkMode: false, // 显示日间/夜间模式切换 showToc: true, // 移动端显示悬浮目录 showShareBar: false, // 文章分享功能 showRelatePosts: true, // 相关文章推荐 diff --git a/components/ArticleDetail.js b/components/ArticleDetail.js index 097a5242..458e9445 100644 --- a/components/ArticleDetail.js +++ b/components/ArticleDetail.js @@ -4,8 +4,6 @@ import Comment from '@/components/Comment' import RecommendPosts from '@/components/RecommendPosts' import ShareBar from '@/components/ShareBar' import TagItem from '@/components/TagItem' -import TocDrawer from '@/components/TocDrawer' -import TocDrawerButton from '@/components/TocDrawerButton' import formatDate from '@/lib/formatDate' import { useGlobal } from '@/lib/global' import { faEye, faFolderOpen } from '@fortawesome/free-solid-svg-icons' @@ -22,7 +20,6 @@ import 'prismjs/components/prism-typescript' import { useEffect, useRef } from 'react' import { Code, Collection, CollectionRow, Equation, NotionRenderer } from 'react-notion-x' import ArticleCopyright from './ArticleCopyright' -import Live2D from './Live2D' import WordCount from './WordCount' /** @@ -31,8 +28,6 @@ import WordCount from './WordCount' * @returns */ export default function ArticleDetail ({ post, recommendPosts, prev, next }) { - const targetRef = useRef(null) - const drawerRight = useRef(null) const url = BLOG.link + useRouter().asPath const { locale } = useGlobal() const date = formatDate(post?.date?.start_date || post.createdTime, locale.LOCALE) @@ -55,144 +50,132 @@ export default function ArticleDetail ({ post, recommendPosts, prev, next }) { } }) - return (<> -
-
+ return (
+
-
- {post.type && !post.type.includes('Page') && post?.page_cover && ( -
- {/* eslint-disable-next-line @next/next/no-img-element */} - {post.title} - {/*
- {post.title} -
*/} -
- )} - - {/* 文章Title */} -
- {post.title} -
- -
-
- - - - {post.category} - - - | - - {post.type[0] !== 'Page' && (<> - - - {date} - - - | - )} - -
- -   - - | -
-
-
- -
- -
- - {/*
*/} - -
- - {/* Notion文章主体 */} -
- {post.blockMap && ( - + {post.type && !post.type.includes('Page') && post?.page_cover && ( +
+ {/* eslint-disable-next-line @next/next/no-img-element */} + {post.title} + {/*
+ {post.title} - )} -
+
*/} +
+ )} -
- {/* 文章内嵌广告 */} - -
- - {/* 版权声明 */} - - - {/* 推荐文章 */} - - - {/* 标签列表 */} -
- {post.tagItems && ( -
-
- {locale.COMMON.TAGS}: -
- {post.tagItems.map(tag => ( - - ))} -
- )} -
- -
-
- - - - - - {/* 评论互动 */} -
- + {/* 文章Title */} +
+ {post.title}
-
- {/* 悬浮目录按钮 */} -
- { drawerRight.current.handleSwitchVisible() }} /> - -
+
+
+ + + + {post.category} + + + | - {/* 宠物 */} - + {post.type[0] !== 'Page' && (<> + + + {date} + + + | + )} - ) +
+ +   + + | +
+
+
+ +
+ +
+ + {/*
*/} + + + + {/* Notion文章主体 */} +
+ {post.blockMap && ( + + )} +
+ +
+ {/* 文章内嵌广告 */} + +
+ + {/* 版权声明 */} + + + {/* 推荐文章 */} + + + {/* 标签列表 */} +
+ {post.tagItems && ( +
+
+ {locale.COMMON.TAGS}: +
+ {post.tagItems.map(tag => ( + + ))} +
+ )} +
+ +
+
+ + + + + + {/* 评论互动 */} +
+ +
+ ) } const mapPageUrl = id => { diff --git a/components/FloatDarkModeButton.js b/components/FloatDarkModeButton.js index ae082836..bf01f26b 100644 --- a/components/FloatDarkModeButton.js +++ b/components/FloatDarkModeButton.js @@ -1,27 +1,13 @@ -import { useEffect, useState } from 'react' +import BLOG from '@/blog.config' import { useGlobal } from '@/lib/global' +import { loadUserThemeFromCookies, saveTheme } from '@/lib/theme' import { faMoon, faSun } from '@fortawesome/free-solid-svg-icons' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' -import BLOG from '@/blog.config' -import { loadUserThemeFromCookies, saveTheme } from '@/lib/theme' export default function FloatDarkModeButton () { if (!BLOG.widget?.showDarkMode) { return <> } - const [show, switchShow] = useState(false) - const scrollListener = () => { - const scrollY = window.pageYOffset - const shouldShow = scrollY > 100 - if (shouldShow !== show) { - switchShow(shouldShow) - } - } - useEffect(() => { - scrollListener() - document.addEventListener('scroll', scrollListener) - return () => document.removeEventListener('scroll', scrollListener) - }, [show]) const { changeTheme } = useGlobal() const userTheme = loadUserThemeFromCookies() @@ -37,12 +23,8 @@ export default function FloatDarkModeButton () { return (