diff --git a/components/BlogPostListEmpty.js b/components/BlogPostListEmpty.js index 0cca9919..37982cd9 100644 --- a/components/BlogPostListEmpty.js +++ b/components/BlogPostListEmpty.js @@ -6,18 +6,10 @@ import { useEffect } from 'react' * @returns {JSX.Element} * @constructor */ -const BlogPostListEmpty = () => { - const router = useRouter() - useEffect(() => { - setTimeout(() => { - router.push('/').then(() => { - console.log('空博客列表跳回首页') - }) - }, 3000) - }) - return
-
-

没有文章了,3秒后返回首页

+const BlogPostListEmpty = ({ currentSearch }) => { + return
+
+

没有找到文章 {(currentSearch &&

{currentSearch}
)}

} diff --git a/components/BlogPostListScroll.js b/components/BlogPostListScroll.js index e1092954..5d8d7a29 100644 --- a/components/BlogPostListScroll.js +++ b/components/BlogPostListScroll.js @@ -49,9 +49,9 @@ const BlogPostListScroll = ({ posts = [], tags, currentSearch, currentCategory, const targetRef = useRef(null) if (!postsToShow || postsToShow.length === 0) { - return + return } else { - return
+ return
{currentCategory && (
diff --git a/components/DarkModeButton.js b/components/DarkModeButton.js index 8f7325c7..7450ac3d 100644 --- a/components/DarkModeButton.js +++ b/components/DarkModeButton.js @@ -9,7 +9,7 @@ const DarkModeButton = () => { saveTheme(newTheme) changeTheme(newTheme) } - return
+ return
diff --git a/components/JumpToTopButton.js b/components/JumpToTopButton.js index 73dd706a..71dea964 100644 --- a/components/JumpToTopButton.js +++ b/components/JumpToTopButton.js @@ -1,5 +1,4 @@ -import React, { useCallback, useEffect, useState } from 'react' -import throttle from 'lodash.throttle' +import React, { useEffect, useState } from 'react' import { useGlobal } from '@/lib/global' /** @@ -33,15 +32,15 @@ const JumpToTopButton = ({ targetRef, showPercent = true }) => { }, [show]) return ( -
-
+
+
window.scrollTo({ top: 0, behavior: 'smooth' })} style={{ boxShadow: 'rgba(41, 50, 60, 0.5) 0px 2px 16px', borderRadius: '28px' }} - className={(show ? 'animate__fadeInUp' : 'animate__fadeOutUp') + ' bg-gray-700 px-2.5 py-2 cursor-pointer animate__animated animate__faster shadow-2xl'}> + className={(show ? 'animate__fadeInUp' : 'animate__fadeOutUp') + ' bg-gray-700 px-1 py-1 cursor-pointer animate__animated animate__faster shadow-2xl'}>
-
- {showPercent && (
 {percent}%
)} +
+ {showPercent && (
{percent}
)}
diff --git a/components/SideBar.js b/components/SideBar.js index 9c8b43f9..7f3ba827 100644 --- a/components/SideBar.js +++ b/components/SideBar.js @@ -6,6 +6,7 @@ import LatestPosts from '@/components/LatestPosts' import PostsCategories from '@/components/PostsCategories' import Toc from '@/components/Toc' import SearchInput from '@/components/SearchInput' +import DarkModeButton from '@/components/DarkModeButton' /** * 侧边栏 @@ -28,7 +29,7 @@ const SideBar = ({ tags, currentTag, post, posts, categories, currentCategory }) }).slice(0, 5) } - return