diff --git a/components/BlogPostListScroll.js b/components/BlogPostListScroll.js index 5d8d7a29..423ee6c0 100644 --- a/components/BlogPostListScroll.js +++ b/components/BlogPostListScroll.js @@ -51,7 +51,7 @@ const BlogPostListScroll = ({ posts = [], tags, currentSearch, currentCategory, if (!postsToShow || postsToShow.length === 0) { return } else { - return
+ return
{currentCategory && (
diff --git a/components/JumpToTopButton.js b/components/JumpToTopButton.js index 69db5db8..4a949db0 100644 --- a/components/JumpToTopButton.js +++ b/components/JumpToTopButton.js @@ -18,12 +18,14 @@ const JumpToTopButton = ({ targetRef, showPercent = true }) => { const clientHeight = targetRef ? (targetRef.current ? targetRef.current.clientHeight : 0) : 0 const scrollY = window.pageYOffset const fullHeight = clientHeight - window.outerHeight - const shouldShow = scrollY > 100 + let per = parseFloat(((scrollY / fullHeight * 100)).toFixed(0)) + if (per > 100) per = 100 + const shouldShow = scrollY > 100 && per > 0 + + if (shouldShow !== show) { switchShow(shouldShow) } - let per = parseFloat(((scrollY / fullHeight * 100)).toFixed(0)) - if (per > 100) per = 100 changePercent(per) } useEffect(() => { diff --git a/components/TagItem.js b/components/TagItem.js index 88499c53..8f2091fb 100644 --- a/components/TagItem.js +++ b/components/TagItem.js @@ -4,7 +4,7 @@ const TagItem = ({ tag }) => (
-
{tag}
+
{tag}
) diff --git a/components/Toc.js b/components/Toc.js index c850949f..9ff24e14 100644 --- a/components/Toc.js +++ b/components/Toc.js @@ -50,9 +50,9 @@ const Toc = ({ toc }) => { setActiveSection(currentSectionId) }, throttleMs)) - return
+ return
+ className='dark:border-gray-600 border-b text-2xl bg-white font-bold text-black dark:bg-gray-900 dark:text-white py-6 px-6'> 文章目录