From bca046cf03fef5ca8f9c1b564b64856900ee918d Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Wed, 8 Dec 2021 17:21:07 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20=E8=B0=83=E6=95=B4=E5=AD=97=E4=BD=93?= =?UTF-8?q?=EF=BC=8C=E9=87=8D=E6=96=B0=E6=8E=92=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/BlogPostCard.js | 18 +++++++++--------- components/BlogPostListScroll.js | 2 +- components/CategoryGroup.js | 4 ++-- components/InfoCard.js | 10 +++++----- components/LatestPostsGroup.js | 19 +++++++++---------- components/MenuButtonGroup.js | 4 ++-- components/SearchInput.js | 4 ++-- components/SideBar.js | 31 ++++++++++++++++--------------- components/Toc.js | 6 +++--- components/TocDrawer.js | 2 +- components/TopNav.js | 2 +- layouts/BaseLayout.js | 6 ++++-- pages/archive/index.js | 2 +- pages/article/[slug].js | 10 +++++----- pages/category/[category].js | 2 +- pages/category/index.js | 2 +- pages/index.js | 2 +- pages/search.js | 2 +- pages/tag/[tag].js | 2 +- pages/tag/index.js | 2 +- tailwind.config.js | 20 -------------------- 21 files changed, 67 insertions(+), 85 deletions(-) diff --git a/components/BlogPostCard.js b/components/BlogPostCard.js index dfc22be6..8bb7533f 100644 --- a/components/BlogPostCard.js +++ b/components/BlogPostCard.js @@ -8,34 +8,34 @@ import { faFolder } from '@fortawesome/free-solid-svg-icons' const BlogPostCard = ({ post, tags }) => { return ( -
-
- 1) ? post.page_cover : BLOG.defaultImgCover} alt={post.title} layout='fill' objectFit='cover' loading='lazy' /> +
+ 1) ? post.page_cover : BLOG.defaultImgCover} alt={post.title} layout='fill' objectFit='cover' loading='lazy' />
-
+
- + {post.category} - | + | - {post.date.start_date} + {post.date.start_date}
-

+

{post.title}

-

{post.summary}

+

{post.summary}

{post.tagItems.map(tag => ())}
diff --git a/components/BlogPostListScroll.js b/components/BlogPostListScroll.js index 8d0d76c4..7b027d42 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
{/* 文章列表 */}
diff --git a/components/CategoryGroup.js b/components/CategoryGroup.js index 3d2b8dbd..f182b9d6 100644 --- a/components/CategoryGroup.js +++ b/components/CategoryGroup.js @@ -4,7 +4,7 @@ import Link from 'next/link' import React from 'react' const CategoryGroup = ({ currentCategory, categories }) => { - return
+ return
{Object.keys(categories).map(category => { const selected = currentCategory === category @@ -12,7 +12,7 @@ const CategoryGroup = ({ currentCategory, categories }) => {
+ ' duration-300 hover:text-blue-500 dark:hover:text-blue-400 hover:underline px-5 cursor-pointer pt-2 font-serif'}> {category}({categories[category]})
})} diff --git a/components/InfoCard.js b/components/InfoCard.js index 94e9b625..57c391cd 100644 --- a/components/InfoCard.js +++ b/components/InfoCard.js @@ -5,18 +5,18 @@ import Router from 'next/router' const InfoCard = () => { return <> -
{ Router.push('/') }}> -
+
{ Router.push('/') }}> +
{BLOG.title}
-
{BLOG.title}
+
{BLOG.title}
} diff --git a/components/LatestPostsGroup.js b/components/LatestPostsGroup.js index 80047da1..175ec24b 100644 --- a/components/LatestPostsGroup.js +++ b/components/LatestPostsGroup.js @@ -26,26 +26,25 @@ const LatestPostsGroup = ({ posts, sliceCount = 5 }) => { // 获取当前路径 const currentPath = useRouter().asPath - return
+ return <> {postsSortByDate.map(post => { const selected = currentPath === `${BLOG.path}/article/${post.slug}` return ( -
-
- {formatDateFmt(post.lastEditedTime, 'MM/dd')} -
-
+
{post.title}
+
+ {formatDateFmt(post.lastEditedTime, 'yyyy/MM/dd')} +
) })} -
+ } export default LatestPostsGroup diff --git a/components/MenuButtonGroup.js b/components/MenuButtonGroup.js index 788b864d..48b13581 100644 --- a/components/MenuButtonGroup.js +++ b/components/MenuButtonGroup.js @@ -27,8 +27,8 @@ const MenuButtonGroup = ({ allowCollapse = false }) => { if (link.show) { const selected = (router.pathname === link.to) || (router.asPath === link.to) return - +
diff --git a/components/SearchInput.js b/components/SearchInput.js index 94c162dc..8648aa09 100644 --- a/components/SearchInput.js +++ b/components/SearchInput.js @@ -42,12 +42,12 @@ const SearchInput = ({ currentTag, currentSearch }) => { ref={searchInputRef} type='text' placeholder={currentTag ? `${locale.SEARCH.TAGS} #${currentTag}` : `${locale.SEARCH.ARTICLES}`} - className={'w-full pl-2 transition leading-10 border-gray-300 bg-white text-black bg-gray-100 dark:bg-gray-900 dark:text-white'} + className={'w-full pl-2 transition leading-10 border-gray-300 text-black bg-gray-100 dark:bg-gray-900 dark:text-white'} onKeyUp={handleKeyUp} onChange={e => updateSearchKey(e.target.value)} defaultValue={currentSearch} /> - {(searchKey && searchKey.length && )} + {(searchKey && searchKey.length && )}
{ handleSearch(searchKey) }}> diff --git a/components/SideBar.js b/components/SideBar.js index fd00fd34..5ad963fb 100644 --- a/components/SideBar.js +++ b/components/SideBar.js @@ -27,21 +27,22 @@ const SideBar = ({ tags, currentTag, post, posts, categories, currentCategory, c const { locale } = useGlobal() return