diff --git a/components/LatestPosts.js b/components/LatestPosts.js index b5caaf1f..20a5e9a4 100644 --- a/components/LatestPosts.js +++ b/components/LatestPosts.js @@ -14,14 +14,14 @@ const LatestPosts = ({ posts }) => { // 时间排序 postsSortByDate.sort((a, b) => { - const dateA = new Date(a?.lastEditedTime || a.createdTime) - const dateB = new Date(b?.lastEditedTime || b.createdTime) - return dateB - dateA + const dateA = new Date(a?.lastEditedTime || a.createdTime) + const dateB = new Date(b?.lastEditedTime || b.createdTime) + return dateB - dateA }) // 只取前五 postsSortByDate = postsSortByDate.slice(0, 5) - + // 获取当前路径 const currentPath = useRouter().asPath @@ -33,12 +33,14 @@ const LatestPosts = ({ posts }) => {
{postsSortByDate.map(post => { return ( - -
+ +
{formatDateFmt(post.lastEditedTime, 'yyyy/MM/dd')}
-
+
{post.title}
diff --git a/components/TagItem.js b/components/TagItem.js index 574e86d9..6466b4b6 100644 --- a/components/TagItem.js +++ b/components/TagItem.js @@ -1,12 +1,24 @@ import Link from 'next/link' +import React from 'react' -const TagItem = ({ tag, count }) => ( - -
- {tag}{count && `(${count})`} -
+const TagItem = ({ tag, selected }) => { + return ( + +
  • + + + {`${tag.name} `} {tag.count ? `(${tag.count})` : ''} + +
  • -) + ) +} export default TagItem diff --git a/components/TagItemMini.js b/components/TagItemMini.js index eb6e37e4..f0131486 100644 --- a/components/TagItemMini.js +++ b/components/TagItemMini.js @@ -2,11 +2,11 @@ import Link from 'next/link' const TagItemMini = ({ tag, selected = false }) => { return -
    + ? 'text-white dark:text-gray-300 bg-black dark:bg-black dark:hover:bg-gray-900' + : `text-gray-500 dark:text-gray-600 hover:shadow-xl hover:text-white dark:hover:bg-gray-600 dark:border-gray-600 notion-${tag.color}_background `}` }>
    {tag.name + (tag.count ? `(${tag.count})` : '')}
    diff --git a/components/TagList.js b/components/TagList.js index 10adfad9..a2bac134 100644 --- a/components/TagList.js +++ b/components/TagList.js @@ -1,5 +1,6 @@ import Link from 'next/link' import React from 'react' +import TagItem from '@/components/TagItem' /** * 横向的标签列表 @@ -16,20 +17,7 @@ const TagList = ({ tags, currentTag }) => {
  • 标签:
  • {tags.map(tag => { const selected = tag.name === currentTag - return ( - -
  • - - - {`${tag.name} (${tag.count})`} - -
  • - - ) + return })} } diff --git a/pages/article/[slug].js b/pages/article/[slug].js index b0bf47ef..86f790c8 100644 --- a/pages/article/[slug].js +++ b/pages/article/[slug].js @@ -128,14 +128,14 @@ const ArticleDetail = ({ post, blockMap, tags, prev, next, posts, categories })
    - {post.tags && ( + {post.tagItems && (
    标签:
    {post.tagItems.map(tag => ( ))}
    - )} + )}
    diff --git a/pages/tag/index.js b/pages/tag/index.js index 3589bca8..849418b9 100644 --- a/pages/tag/index.js +++ b/pages/tag/index.js @@ -16,7 +16,7 @@ export default function Tag ({ tags, posts, categories }) {
    { tags.map(tag => { - return
    + return
    }) }
    diff --git a/styles/notion.css b/styles/notion.css index 6e84d653..0ee76224 100644 --- a/styles/notion.css +++ b/styles/notion.css @@ -37,6 +37,8 @@ --notion-orange_background: rgb(250, 235, 221); --notion-brown_background: rgb(233, 229, 227); --notion-gray_background: rgb(235, 236, 237); + --notion-green_background: rgb(219, 237, 219); + --notion-default_background: rgba(227, 226, 224); --notion-red_background_co: rgba(251, 228, 228, 0.3); --notion-pink_background_co: rgba(244, 223, 235, 0.3); @@ -47,6 +49,8 @@ --notion-orange_background_co: rgba(250, 235, 221, 0.3); --notion-brown_background_co: rgba(233, 229, 227, 0.3); --notion-gray_background_co: rgba(235, 236, 237, 0.3); + --notion-green_background_co: rgba(219, 237, 219, 0.3); + --notion-default_background_co: rgba(227, 226, 224, 0.3); --notion-item-blue: rgba(0, 120, 223, 0.2); --notion-item-orange: rgba(245, 93, 0, 0.2); @@ -281,6 +285,13 @@ .notion-gray_background { background-color: var(--notion-gray_background); } +.notion-green_background { + background-color: var(--notion-green_background); +} +.notion-default_background { + background-color: var(--notion-default_background); +} + .notion-red_background_co { background-color: var(--notion-red_background_co); } @@ -308,6 +319,12 @@ .notion-gray_background_co { background-color: var(--notion-gray_background_co); } +.notion-green_background_co { + background-color: var(--notion-green_background_co); +} +.notion-default_background_co { + background-color: var(--notion-default_background_co); +} .notion-item-blue { background-color: var(--notion-item-blue);