diff --git a/components/BlogPostListScroll.js b/components/BlogPostListScroll.js index f62f2983..5ff9f721 100644 --- a/components/BlogPostListScroll.js +++ b/components/BlogPostListScroll.js @@ -53,18 +53,6 @@ const BlogPostListScroll = ({ posts = [], tags, currentSearch, currentCategory, } else { return
-
- {currentCategory && ( -
{currentCategory}
- )} - {currentSearch && ( -
关键字:{currentSearch}
- )} - {currentTag && ( -
{currentTag}
- )} -
- {/* 文章列表 */}
{postsToShow.map(post => ( diff --git a/components/PostsCategories.js b/components/CategoryGroup.js similarity index 89% rename from components/PostsCategories.js rename to components/CategoryGroup.js index 53459fa5..3acb7ec7 100644 --- a/components/PostsCategories.js +++ b/components/CategoryGroup.js @@ -1,7 +1,7 @@ import Link from 'next/link' import React from 'react' -const PostsCategories = ({ currentCategory, categories }) => { +const CategoryGroup = ({ currentCategory, categories }) => { return <>
@@ -19,4 +19,4 @@ const PostsCategories = ({ currentCategory, categories }) => { } -export default PostsCategories +export default CategoryGroup diff --git a/components/CategoryList.js b/components/CategoryList.js new file mode 100644 index 00000000..f9197cd8 --- /dev/null +++ b/components/CategoryList.js @@ -0,0 +1,26 @@ +import Link from 'next/link' +import React from 'react' + +const CategoryList = ({ currentCategory, categories }) => { + return
    +
  • 分类:
  • + {Object.keys(categories).map(category => { + const selected = category === currentCategory + return ( + +
  • + + + {`${category} `} + +
  • + ) + })} +
+} + +export default CategoryList diff --git a/components/RecommendPosts.js b/components/RecommendPosts.js index ccec996d..1bcd8195 100644 --- a/components/RecommendPosts.js +++ b/components/RecommendPosts.js @@ -34,11 +34,11 @@ const RecommendPosts = ({ currentPost, totalPosts }) => { filteredPosts = filteredPosts.slice(0, 5) } - return
+ return

相关推荐

diff --git a/components/SideBar.js b/components/SideBar.js index 6b4eb05a..0e89154b 100644 --- a/components/SideBar.js +++ b/components/SideBar.js @@ -1,9 +1,9 @@ import React from 'react' import MenuButtonGroup from '@/components/MenuButtonGroup' import InfoCard from '@/components/InfoCard' -import TagList from '@/components/TagList' +import TagGroups from '@/components/TagGroups' import LatestPosts from '@/components/LatestPosts' -import PostsCategories from '@/components/PostsCategories' +import CategoryGroup from '@/components/CategoryGroup' import Toc from '@/components/Toc' import SearchInput from '@/components/SearchInput' import Link from 'next/link' @@ -16,10 +16,11 @@ import Link from 'next/link' * @param posts * @param categories * @param currentCategory + * @param currentSearch * @returns {JSX.Element} * @constructor */ -const SideBar = ({ tags, currentTag, post, posts, categories, currentCategory }) => { +const SideBar = ({ tags, currentTag, post, posts, categories, currentCategory, currentSearch }) => { return