From 7da44bd0def8ce3667a286d92b8596577ca0c280 Mon Sep 17 00:00:00 2001 From: Vixcity <2091283625@qq.com> Date: Tue, 3 Jan 2023 20:56:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.local | 2 +- components/ThemeSwitch.js | 5 +- next.config.js | 3 + package.json | 10 +- pages/404.js | 2 +- pages/[...slug].js | 2 +- themes/example/LayoutArchive.js | 8 +- themes/example/LayoutCategoryIndex.js | 32 ++- themes/example/LayoutTagIndex.js | 38 ++-- themes/example/components/ArticleInfo.js | 63 +++--- themes/example/components/BlogListPage.js | 84 ++++---- themes/example/components/BlogListScroll.js | 60 +++--- .../components/ExampleRecentComments.js | 4 +- themes/example/components/Header.js | 22 +- themes/example/components/Nav.js | 35 ++- themes/example/components/SideBar.js | 80 +++---- themes/fukasawa/LayoutCategoryIndex.js | 40 ++-- themes/fukasawa/components/ArticleAround.js | 28 +-- themes/fukasawa/components/ArticleDetail.js | 147 +++++++------ themes/fukasawa/components/BlogCard.js | 19 +- themes/fukasawa/components/BlogPostArchive.js | 11 +- themes/fukasawa/components/GroupCategory.js | 21 +- themes/fukasawa/components/GroupMenu.js | 44 ++-- themes/fukasawa/components/Logo.js | 14 +- .../fukasawa/components/PaginationSimple.js | 32 +-- themes/fukasawa/components/TagItem.js | 25 +-- themes/fukasawa/components/TagItemMini.js | 24 +-- themes/hexo/LayoutCategoryIndex.js | 6 +- themes/hexo/LayoutSearch.js | 106 +++++----- themes/hexo/LayoutTag.js | 30 ++- themes/hexo/components/ArticleAdjacent.js | 28 +-- themes/hexo/components/ArticleCopyright.js | 42 ++-- themes/hexo/components/ArticleRecommend.js | 33 +-- themes/hexo/components/BlogPostArchive.js | 13 +- themes/hexo/components/BlogPostCard.js | 42 ++-- themes/hexo/components/Catalog.js | 10 +- themes/hexo/components/CategoryGroup.js | 24 +-- themes/hexo/components/HeaderArticle.js | 12 +- themes/hexo/components/HexoRecentComments.js | 26 ++- themes/hexo/components/LatestPostsGroup.js | 80 +++---- themes/hexo/components/Logo.js | 12 +- themes/hexo/components/MenuButtonGroupTop.js | 41 ++-- themes/hexo/components/MenuGroupCard.js | 41 ++-- themes/hexo/components/MenuList.js | 46 ++-- themes/hexo/components/NavButtonGroup.js | 23 +- themes/hexo/components/PaginationNumber.js | 84 ++++---- themes/hexo/components/TagItemMini.js | 24 +-- themes/hexo/components/TopNav.js | 22 +- themes/matery/LayoutCategory.js | 42 ++-- themes/matery/LayoutCategoryIndex.js | 36 ++-- themes/matery/LayoutSearch.js | 106 +++++----- themes/matery/LayoutSlug.js | 4 +- themes/matery/components/ArticleCopyright.js | 42 ++-- themes/matery/components/ArticleInfo.js | 62 +++--- themes/matery/components/ArticleRecommend.js | 37 ++-- themes/matery/components/BlogPostArchive.js | 13 +- themes/matery/components/BlogPostCard.js | 137 ++++++------ themes/matery/components/Catalog.js | 6 +- themes/matery/components/CategoryGroup.js | 24 +-- .../matery/components/HexoRecentComments.js | 26 ++- themes/matery/components/LatestPostsGroup.js | 80 +++---- themes/matery/components/Logo.js | 12 +- .../matery/components/MenuButtonGroupTop.js | 41 ++-- themes/matery/components/MenuGroupCard.js | 41 ++-- themes/matery/components/MenuList.js | 46 ++-- themes/matery/components/NavButtonGroup.js | 23 +- themes/matery/components/PaginationNumber.js | 84 ++++---- themes/matery/components/PaginationSimple.js | 6 +- themes/matery/components/SideBar.js | 66 +++--- themes/matery/components/TagItemMiddle.js | 22 +- themes/matery/components/TagItemMini.js | 18 +- themes/matery/components/TopNav.js | 76 +++---- themes/medium/LayoutArchive.js | 10 +- themes/medium/LayoutCategoryIndex.js | 40 ++-- themes/medium/components/ArticleAround.js | 28 +-- themes/medium/components/ArticleDetail.js | 98 +++++---- themes/medium/components/BlogPostCard.js | 32 ++- themes/medium/components/BottomMenuBar.js | 6 +- themes/medium/components/CategoryItem.js | 19 +- themes/medium/components/GroupMenu.js | 44 ++-- themes/medium/components/LeftMenuBar.js | 20 +- themes/medium/components/LogoBar.js | 12 +- themes/medium/components/PaginationSimple.js | 32 +-- themes/medium/components/TagItemMini.js | 24 +-- themes/medium/components/TopNavBar.js | 75 +++---- themes/next/LayoutCategoryIndex.js | 40 ++-- themes/next/components/ArticleCopyright.js | 42 ++-- themes/next/components/ArticleDetail.js | 199 +++++++++--------- themes/next/components/BlogAround.js | 28 +-- themes/next/components/BlogPostArchive.js | 13 +- themes/next/components/BlogPostCard.js | 52 ++--- themes/next/components/CategoryGroup.js | 21 +- themes/next/components/CategoryList.js | 49 ++--- themes/next/components/ContactButton.js | 12 +- themes/next/components/LatestPostsGroup.js | 64 +++--- themes/next/components/Logo.js | 14 +- themes/next/components/MenuButtonGroup.js | 47 ++--- themes/next/components/NextRecentComments.js | 4 +- themes/next/components/PaginationNumber.js | 112 +++++----- themes/next/components/PaginationSimple.js | 6 +- themes/next/components/RecommendPosts.js | 10 +- themes/next/components/SideAreaRight.js | 116 +++++----- themes/next/components/SideBar.js | 112 +++++----- themes/next/components/TagItem.js | 25 +-- themes/next/components/TagItemMini.js | 24 +-- themes/next/components/TopNav.js | 22 +- themes/nobelium/LayoutArchive.js | 10 +- themes/nobelium/LayoutCategoryIndex.js | 32 ++- themes/nobelium/LayoutTagIndex.js | 38 ++-- themes/nobelium/components/BlogListPage.js | 38 ++-- themes/nobelium/components/BlogListScroll.js | 60 +++--- themes/nobelium/components/BlogPost.js | 40 ++-- .../components/ExampleRecentComments.js | 4 +- themes/nobelium/components/Nav.js | 152 ++++++------- themes/nobelium/components/SideBar.js | 80 +++---- themes/nobelium/components/TagItem.js | 14 +- themes/nobelium/components/Tags.js | 8 +- 117 files changed, 2072 insertions(+), 2506 deletions(-) diff --git a/.env.local b/.env.local index 2d0e2eba..a5695000 100644 --- a/.env.local +++ b/.env.local @@ -1,2 +1,2 @@ # 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables -NEXT_PUBLIC_VERSION=3.8.0 +NEXT_PUBLIC_VERSION=3.7.3 diff --git a/components/ThemeSwitch.js b/components/ThemeSwitch.js index d9d8b9b6..17973c04 100644 --- a/components/ThemeSwitch.js +++ b/components/ThemeSwitch.js @@ -19,9 +19,10 @@ export function ThemeSwitch() {
{/*
{theme}
*/} - {ALL_THEME.map(t => { - return + const selected = t === theme + return })}
diff --git a/next.config.js b/next.config.js index fb92a754..f2a86bc5 100644 --- a/next.config.js +++ b/next.config.js @@ -3,6 +3,9 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({ }) module.exports = withBundleAnalyzer({ + future: { + webpack5: true + }, images: { // 图片压缩 formats: ['image/avif', 'image/webp'], diff --git a/package.json b/package.json index c83a29c2..8e401fc8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "notion-next", - "version": "3.8.0", + "version": "3.7.3", "homepage": "https://github.com/tangly1024/NotionNext.git", "license": "MIT", "repository": { @@ -40,16 +40,16 @@ "memory-cache": "^0.2.0", "mermaid": "9.2.2", "mongodb": "^4.6.0", - "next": "^13.1.1", + "next": "12.1.6", "notion-client": "6.15.6", "notion-utils": "6.15.6", "preact": "^10.5.15", "prism-themes": "1.9.0", "qrcode.react": "^1.0.1", - "react": "^18.2.0", + "react": "17.0.2", "react-cookies": "^0.1.1", "react-cusdis": "^2.1.3", - "react-dom": "^18.2.0", + "react-dom": "17.0.2", "react-facebook": "^8.1.4", "react-messenger-customer-chat": "^0.8.0", "react-notion-x": "6.15.6", @@ -64,7 +64,7 @@ "@waline/client": "^2.5.1", "autoprefixer": "^10.4.13", "eslint": "^7.26.0", - "eslint-config-next": "^13.1.1", + "eslint-config-next": "^11.0.0", "eslint-config-standard": "^16.0.2", "eslint-plugin-import": "^2.23.0", "eslint-plugin-node": "^11.1.0", diff --git a/pages/404.js b/pages/404.js index d63b1e5e..43172bfb 100644 --- a/pages/404.js +++ b/pages/404.js @@ -15,7 +15,7 @@ const NoFound = props => { } export async function getStaticProps () { - const props = (await getGlobalNotionData({ from: '404' })) || {} + const props = await getGlobalNotionData({ from: '404' }) || {} return { props } } diff --git a/pages/[...slug].js b/pages/[...slug].js index e5607ed7..3013696d 100644 --- a/pages/[...slug].js +++ b/pages/[...slug].js @@ -50,7 +50,7 @@ const Slug = props => { } } }, 20 * 1000) - const meta = { title: `${props?.siteInfo?.title || BLOG.TITLE} | loading`, image: siteInfo?.pageCover || BLOG.HOME_BANNER_IMAGE } + const meta = { title: `${props?.siteInfo?.title || BLOG.TITLE} | loading`, image: siteInfo?.pageCover } return } diff --git a/themes/example/LayoutArchive.js b/themes/example/LayoutArchive.js index a89265f3..b85860e0 100644 --- a/themes/example/LayoutArchive.js +++ b/themes/example/LayoutArchive.js @@ -45,10 +45,10 @@ export const LayoutArchive = props => { - - {post.title} - + > + + {post.title} + diff --git a/themes/example/LayoutCategoryIndex.js b/themes/example/LayoutCategoryIndex.js index 1230c20f..28b98b6e 100644 --- a/themes/example/LayoutCategoryIndex.js +++ b/themes/example/LayoutCategoryIndex.js @@ -4,24 +4,16 @@ import LayoutBase from './LayoutBase' export const LayoutCategoryIndex = (props) => { const { categories } = props - return ( - -
- {categories && categories.map(category => { - return ( - -
- {category.name}({category.count}) -
- - ) - })} -
-
- ) + return +
+ {categories && categories.map(category => { + return +
+ {category.name}({category.count}) +
+ + })} +
+
} diff --git a/themes/example/LayoutTagIndex.js b/themes/example/LayoutTagIndex.js index 6d2873a8..6a89e168 100644 --- a/themes/example/LayoutTagIndex.js +++ b/themes/example/LayoutTagIndex.js @@ -3,27 +3,19 @@ import LayoutBase from './LayoutBase' export const LayoutTagIndex = (props) => { const { tags } = props - return ( - -
-
- {tags.map(tag => { - return ( -
- - -
{tag.name + (tag.count ? `(${tag.count})` : '')}
- - -
- ); - })} -
-
- ); + return +
+
+ {tags.map(tag => { + return + })} +
+
} diff --git a/themes/example/components/ArticleInfo.js b/themes/example/components/ArticleInfo.js index 0b34fb12..7317d533 100644 --- a/themes/example/components/ArticleInfo.js +++ b/themes/example/components/ArticleInfo.js @@ -8,45 +8,40 @@ export const ArticleInfo = (props) => { const { locale } = useGlobal() const date = formatDate(post?.date?.start_date || post?.createdTime, locale.LOCALE) - return ( -
-
- {post?.type !== 'Page' && <> - - + return
+
+ {post?.type !== 'Page' && <> + + {post.category} + + + | + } - - | - } - - {post?.type !== 'Page' && (<> - - + {post?.type !== 'Page' && (<> + + {date} - - - | - - {locale.COMMON.LAST_EDITED_TIME}: {post.lastEditedTime} - - | - - -   - + + + | + + {locale.COMMON.LAST_EDITED_TIME}: {post.lastEditedTime} - )} + | + + +   + + + )} -
+
-
- ) + } diff --git a/themes/example/components/BlogListPage.js b/themes/example/components/BlogListPage.js index 390bf90a..c98ccd54 100644 --- a/themes/example/components/BlogListPage.js +++ b/themes/example/components/BlogListPage.js @@ -15,55 +15,47 @@ export const BlogListPage = props => { const showNext = page < totalPage const pagePrefix = router.asPath.replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '') - return ( -
+ return
-
- {posts?.map(p => ( -
-

- - {p.title} - -

+
+ {posts?.map(p => ( +
+

+ + {p.title} + +

-
- by {BLOG.AUTHOR} on {p.date?.start_date || p.createdTime} - | - {p.category} - {/* | */} - {/* 2 Comments */} -
+
+ by {BLOG.AUTHOR} on {p.date?.start_date || p.createdTime} + | + {p.category} + {/* | */} + {/* 2 Comments */} +
-

- {p.summary} +

+ {p.summary} +

+ {/* 搜索结果 */} + {p.results && ( +

+ {p.results.map(r => ( + {r} + ))}

- {/* 搜索结果 */} - {p.results && ( -

- {p.results.map(r => ( - {r} - ))} -

- )} -
- ))} -
- -
- - {locale.PAGINATION.PREV} - - - {locale.PAGINATION.NEXT} - -
+ )} +
+ ))}
- ); + + +
} diff --git a/themes/example/components/BlogListScroll.js b/themes/example/components/BlogListScroll.js index d70e4bc5..c9859c0b 100644 --- a/themes/example/components/BlogListScroll.js +++ b/themes/example/components/BlogListScroll.js @@ -43,40 +43,36 @@ export const BlogListScroll = props => { } }) - return ( -
- {postsToShow.map(p => ( -
-

- - {p.title} - -

+ return
+ {postsToShow.map(p => ( + - ))} - -
- {' '} - {hasMore ? locale.COMMON.MORE : `${locale.COMMON.NO_MORE} 😰`}{' '} -
+

+ {p.summary} +

+
+ ))} +
+ {' '} + {hasMore ? locale.COMMON.MORE : `${locale.COMMON.NO_MORE} 😰`}{' '}
- ); + +
} diff --git a/themes/example/components/ExampleRecentComments.js b/themes/example/components/ExampleRecentComments.js index 42c8805e..e1fe86ca 100644 --- a/themes/example/components/ExampleRecentComments.js +++ b/themes/example/components/ExampleRecentComments.js @@ -26,10 +26,10 @@ const ExampleRecentComments = (props) => { {!onLoading && comments && comments.length === 0 &&
No Comments
} {!onLoading && comments && comments.length > 0 && comments.map((comment) =>
-
--{comment.nick}
+
)} - ; + } export default ExampleRecentComments diff --git a/themes/example/components/Header.js b/themes/example/components/Header.js index 7c8355ae..424edcae 100644 --- a/themes/example/components/Header.js +++ b/themes/example/components/Header.js @@ -7,19 +7,15 @@ import Link from 'next/link' export const Header = (props) => { const { siteInfo } = props - return ( -
-
- - + return
+
- ); +
+
} diff --git a/themes/example/components/Nav.js b/themes/example/components/Nav.js index 5bfb8b2d..26610035 100644 --- a/themes/example/components/Nav.js +++ b/themes/example/components/Nav.js @@ -20,25 +20,20 @@ export const Nav = (props) => { links = links.concat(customNav) } - return ( - } diff --git a/themes/example/components/SideBar.js b/themes/example/components/SideBar.js index 986063b0..ea45f851 100644 --- a/themes/example/components/SideBar.js +++ b/themes/example/components/SideBar.js @@ -8,58 +8,48 @@ const ExampleRecentComments = dynamic(() => import('./ExampleRecentComments')) export const SideBar = (props) => { const { locale } = useGlobal() const { latestPosts, categories } = props - return ( -
+ return
- - - {BLOG.COMMENT_WALINE_SERVER_URL && BLOG.COMMENT_WALINE_RECENT && } - + -
- ); +
} diff --git a/themes/fukasawa/LayoutCategoryIndex.js b/themes/fukasawa/LayoutCategoryIndex.js index e44e86dc..d517d65c 100644 --- a/themes/fukasawa/LayoutCategoryIndex.js +++ b/themes/fukasawa/LayoutCategoryIndex.js @@ -5,29 +5,21 @@ import LayoutBase from './LayoutBase' export const LayoutCategoryIndex = (props) => { const { locale } = useGlobal() const { categories } = props - return ( - -
-
- {locale.COMMON.CATEGORY}: -
-
- {categories && categories.map(category => { - return ( - -
- {category.name}({category.count}) -
- - ) - })} -
+ return +
+
+ {locale.COMMON.CATEGORY}:
- - ) +
+ {categories && categories.map(category => { + return +
+ {category.name}({category.count}) +
+ + })} +
+
+
} diff --git a/themes/fukasawa/components/ArticleAround.js b/themes/fukasawa/components/ArticleAround.js index b0de69c7..1b145b33 100644 --- a/themes/fukasawa/components/ArticleAround.js +++ b/themes/fukasawa/components/ArticleAround.js @@ -9,24 +9,16 @@ export default function ArticleAround ({ prev, next }) { if (!prev || !next) { return <> } - return ( -
- - + return
+ + {prev.title} - - - - {next.title} + + + + {next.title} - - -
- ); + + +
} diff --git a/themes/fukasawa/components/ArticleDetail.js b/themes/fukasawa/components/ArticleDetail.js index 19968e72..9a939766 100644 --- a/themes/fukasawa/components/ArticleDetail.js +++ b/themes/fukasawa/components/ArticleDetail.js @@ -17,91 +17,86 @@ export default function ArticleDetail(props) { } const { locale } = useGlobal() const date = formatDate(post?.date?.start_date || post?.createdTime, locale.LOCALE) - return ( -
- {post?.type && !post?.type !== 'Page' && post?.page_cover && ( -
- {/* eslint-disable-next-line @next/next/no-img-element */} - {post.title} + return (
+ {post?.type && !post?.type !== 'Page' && post?.page_cover && ( +
+ {/* eslint-disable-next-line @next/next/no-img-element */} + {post.title} +
+ )} +
+ +
+ + {/* 文章Title */} +
+ {post.title}
- )} -
-
+
+
- {/* 文章Title */} -
- {post.title} + {post?.category && (<> + + + + {post.category} + + + | + )} + + {post?.type !== 'Page' && (<> + + + {date} + + + | + + {locale.COMMON.LAST_EDITED_TIME}: {post.lastEditedTime} + + )} + +
+ +   + +
-
-
- - {post?.category && (<> - - - - {post.category} - - - | - )} - - {post?.type !== 'Page' && (<> - - - {date} - - - | - - {locale.COMMON.LAST_EDITED_TIME}: {post.lastEditedTime} - - )} - -
- -   - -
-
- -
- -
- - {/* Notion文章主体 */} -
- {post && }
-
- {/* 文章内嵌广告 */} - -
+
-
+ {/* Notion文章主体 */} +
+ {post && } +
- {post.type === 'Post' && } +
+ {/* 文章内嵌广告 */} + +
- {/* 评论互动 */} -
- -
+ + + {post.type === 'Post' && } + + {/* 评论互动 */} +
+
- ); +
) } diff --git a/themes/fukasawa/components/BlogCard.js b/themes/fukasawa/components/BlogCard.js index 1c42923f..3cde4df0 100644 --- a/themes/fukasawa/components/BlogCard.js +++ b/themes/fukasawa/components/BlogCard.js @@ -13,14 +13,13 @@ const BlogCard = ({ post, showSummary }) => { className="animate__animated animate__fadeIn flex flex-col-reverse justify-between duration-300" >
- - - {post.title} - + + + {post.title} + {(!showPreview || showSummary) && ( @@ -31,7 +30,7 @@ const BlogCard = ({ post, showSummary }) => {
{CONFIG_FUKA.POST_LIST_COVER && post?.page_cover && ( - +
{/* eslint-disable-next-line @next/next/no-img-element */} { )}
- ); + ) } export default BlogCard diff --git a/themes/fukasawa/components/BlogPostArchive.js b/themes/fukasawa/components/BlogPostArchive.js index c594d7d1..45c85ce1 100644 --- a/themes/fukasawa/components/BlogPostArchive.js +++ b/themes/fukasawa/components/BlogPostArchive.js @@ -29,13 +29,10 @@ const BlogArchiveItem = ({ posts = [], archiveTitle }) => {
{post.date?.start_date}{' '}   - - - {post.title} - + + + {post.title} +
diff --git a/themes/fukasawa/components/GroupCategory.js b/themes/fukasawa/components/GroupCategory.js index 876a8f70..fabc2e57 100644 --- a/themes/fukasawa/components/GroupCategory.js +++ b/themes/fukasawa/components/GroupCategory.js @@ -10,22 +10,17 @@ function GroupCategory ({ currentCategory, categories }) {
{categories.map(category => { const selected = currentCategory === category.name - return ( - - + return + {category.name}({category.count}) - - ); + + })}
- ; + } export default GroupCategory diff --git a/themes/fukasawa/components/GroupMenu.js b/themes/fukasawa/components/GroupMenu.js index afaec0e2..906ef217 100644 --- a/themes/fukasawa/components/GroupMenu.js +++ b/themes/fukasawa/components/GroupMenu.js @@ -20,32 +20,24 @@ function GroupMenu ({ customNav }) { links = links.concat(customNav) } - return ( - - ); + return } export default GroupMenu diff --git a/themes/fukasawa/components/Logo.js b/themes/fukasawa/components/Logo.js index 3b6720fb..42cbc268 100644 --- a/themes/fukasawa/components/Logo.js +++ b/themes/fukasawa/components/Logo.js @@ -2,15 +2,11 @@ import Link from 'next/link' const Logo = props => { const { siteInfo } = props - return ( -
- - {siteInfo?.title} - -
- ); + return
+ + {siteInfo?.title} + +
} export default Logo diff --git a/themes/fukasawa/components/PaginationSimple.js b/themes/fukasawa/components/PaginationSimple.js index cbbf23d0..3c737b6d 100644 --- a/themes/fukasawa/components/PaginationSimple.js +++ b/themes/fukasawa/components/PaginationSimple.js @@ -26,12 +26,15 @@ const PaginationSimple = ({ page, showNext }) => { query: router.query.s ? { s: router.query.s } : {} }} passHref - rel="prev" - className={`${ - currentPage === 1 ? 'invisible' : 'visible' - } text-center w-full duration-200 px-4 py-2 hover:border-black border-b-2 hover:font-bold`}> - ←{locale.PAGINATION.PREV} - + > + { query: router.query.s ? { s: router.query.s } : {} }} passHref - rel="next" - className={`${ - showNext ? 'visible' : 'invisible' - } text-center w-full duration-200 px-4 py-2 hover:border-black border-b-2 hover:font-bold`}> - - {locale.PAGINATION.NEXT}→ + > +
- ); + ) } export default PaginationSimple diff --git a/themes/fukasawa/components/TagItem.js b/themes/fukasawa/components/TagItem.js index 18511426..ef1139b5 100644 --- a/themes/fukasawa/components/TagItem.js +++ b/themes/fukasawa/components/TagItem.js @@ -8,20 +8,17 @@ const TagItem = ({ tag, selected }) => {
{ locale.COMMON.NOTAG }
} return ( - -
  • -
    - {selected && } {`${tag.name} `} {tag.count ? `(${tag.count})` : ''} -
    -
  • - - ); + +
  • +
    + {selected && } {`${tag.name} `} {tag.count ? `(${tag.count})` : ''} +
    +
  • + + ) } export default TagItem diff --git a/themes/fukasawa/components/TagItemMini.js b/themes/fukasawa/components/TagItemMini.js index 26295088..fb9efc58 100644 --- a/themes/fukasawa/components/TagItemMini.js +++ b/themes/fukasawa/components/TagItemMini.js @@ -1,21 +1,15 @@ import Link from 'next/link' const TagItemMini = ({ tag, selected = false }) => { - return ( - - -
    {selected && } {tag.name + (tag.count ? `(${tag.count})` : '')}
    - - - ); + return + +
    {selected && } {tag.name + (tag.count ? `(${tag.count})` : '')}
    +
    + } export default TagItemMini diff --git a/themes/hexo/LayoutCategoryIndex.js b/themes/hexo/LayoutCategoryIndex.js index 7d7165a6..6d21da03 100644 --- a/themes/hexo/LayoutCategoryIndex.js +++ b/themes/hexo/LayoutCategoryIndex.js @@ -16,11 +16,7 @@ export const LayoutCategoryIndex = props => {
    {categories.map(category => { return ( - +
    { }, 100) }) return ( - - {!currentSearch && <> -
    - - {/* 分类 */} - -
    - - {locale.COMMON.CATEGORY}: -
    -
    - {categories?.map(category => { - return ( - -
    + {!currentSearch && <> +
    + + {/* 分类 */} + +
    + + {locale.COMMON.CATEGORY}: +
    +
    + {categories?.map(category => { + return ( + - - {category.name}({category.count}) +
    + + {category.name}({category.count}) +
    + + ) + })} +
    +
    + {/* 标签 */} + +
    + + {locale.COMMON.TAGS}: +
    +
    + {tags?.map(tag => { + return ( +
    +
    - - ) - })} -
    -
    - {/* 标签 */} - -
    - - {locale.COMMON.TAGS}: -
    -
    - {tags?.map(tag => { - return ( -
    - -
    - ) - })} -
    -
    -
    - } + ) + })} +
    + +
    + } - {currentSearch && <> -
    - {BLOG.POST_LIST_STYLE === 'page' ? : } -
    - } + {currentSearch && <> +
    + {BLOG.POST_LIST_STYLE === 'page' ? : } +
    + } - + ) } diff --git a/themes/hexo/LayoutTag.js b/themes/hexo/LayoutTag.js index ec8fb6f9..1eb2c249 100644 --- a/themes/hexo/LayoutTag.js +++ b/themes/hexo/LayoutTag.js @@ -10,23 +10,17 @@ export const LayoutTag = (props) => { return t.name === props.tag }) - return ( - - {tag && ( - + )} + {BLOG.POST_LIST_STYLE === 'page' ? : } + } diff --git a/themes/hexo/components/ArticleAdjacent.js b/themes/hexo/components/ArticleAdjacent.js index 6e1face7..f5d14574 100644 --- a/themes/hexo/components/ArticleAdjacent.js +++ b/themes/hexo/components/ArticleAdjacent.js @@ -10,24 +10,16 @@ export default function ArticleAdjacent ({ prev, next }) { if (!prev || !next || !CONFIG_HEXO.ARTICLE_ADJACENT) { return <> } - return ( -
    - - + return
    + + {prev.title} - - - - {next.title} + + + + {next.title} - - -
    - ); + + +
    } diff --git a/themes/hexo/components/ArticleCopyright.js b/themes/hexo/components/ArticleCopyright.js index 80ffd8c9..57151869 100644 --- a/themes/hexo/components/ArticleCopyright.js +++ b/themes/hexo/components/ArticleCopyright.js @@ -16,26 +16,24 @@ export default function ArticleCopyright () { }) const { locale } = useGlobal() - return ( -
    -
      -
    • - {locale.COMMON.AUTHOR}: - - {BLOG.AUTHOR} - -
    • -
    • - {locale.COMMON.URL}: - - {path} - -
    • -
    • - {locale.COMMON.COPYRIGHT}: - {locale.COMMON.COPYRIGHT_NOTICE} -
    • -
    -
    - ); + return
    +
      +
    • + {locale.COMMON.AUTHOR}: + + {BLOG.AUTHOR} + +
    • +
    • + {locale.COMMON.URL}: + + {path} + +
    • +
    • + {locale.COMMON.COPYRIGHT}: + {locale.COMMON.COPYRIGHT_NOTICE} +
    • +
    +
    } diff --git a/themes/hexo/components/ArticleRecommend.js b/themes/hexo/components/ArticleRecommend.js index 30373f67..af081a1c 100644 --- a/themes/hexo/components/ArticleRecommend.js +++ b/themes/hexo/components/ArticleRecommend.js @@ -34,29 +34,32 @@ export default function ArticleRecommend({ recommendPosts, siteInfo }) { : `url("${siteInfo?.pageCover}")` return ( - ( - -
    + -
    - diff --git a/themes/hexo/components/BlogPostArchive.js b/themes/hexo/components/BlogPostArchive.js index 20887d45..227a2697 100644 --- a/themes/hexo/components/BlogPostArchive.js +++ b/themes/hexo/components/BlogPostArchive.js @@ -29,20 +29,17 @@ const BlogPostArchive = ({ posts = [], archiveTitle }) => {
    {post.date?.start_date}{' '}   - - - {post.title} - + + + {post.title} +
    ))}
    - ); + ) } } diff --git a/themes/hexo/components/BlogPostCard.js b/themes/hexo/components/BlogPostCard.js index dd6cabde..06f4d8c7 100644 --- a/themes/hexo/components/BlogPostCard.js +++ b/themes/hexo/components/BlogPostCard.js @@ -20,14 +20,13 @@ const BlogPostCard = ({ post, showSummary }) => { className="animate__animated animate__fadeIn flex flex-col-reverse lg:flex-row justify-between duration-300" >
    - - - {post.title} - + + + {post.title} +
    { - - - {post.date?.start_date || post.lastEditedTime} - + > + + + {post.date?.start_date || post.lastEditedTime} +
    @@ -68,14 +67,11 @@ const BlogPostCard = ({ post, showSummary }) => { )}
    - - - - {post.category} - + + + + {post.category} +
    @@ -89,7 +85,7 @@ const BlogPostCard = ({ post, showSummary }) => {
    {CONFIG_HEXO.POST_LIST_COVER && !showPreview && post?.page_cover && !post.results && ( - +
    {/* eslint-disable-next-line @next/next/no-img-element */} { )}
    - ); + ) } export default BlogPostCard diff --git a/themes/hexo/components/Catalog.js b/themes/hexo/components/Catalog.js index 9c80cd1a..c51ee499 100644 --- a/themes/hexo/components/Catalog.js +++ b/themes/hexo/components/Catalog.js @@ -10,6 +10,10 @@ import Progress from './Progress' * @constructor */ const Catalog = ({ toc }) => { + // 无目录就直接返回空 + if (!toc || toc.length < 1) { + return <> + } // 监听滚动事件 React.useEffect(() => { window.addEventListener('scroll', actionSectionScrollSpy) @@ -25,7 +29,6 @@ const Catalog = ({ toc }) => { // 同步选中目录事件 const [activeSection, setActiveSection] = React.useState(null) - const throttleMs = 100 const actionSectionScrollSpy = React.useCallback(throttle(() => { const sections = document.getElementsByClassName('notion-h') @@ -54,11 +57,6 @@ const Catalog = ({ toc }) => { tRef?.current?.scrollTo({ top: 28 * index, behavior: 'smooth' }) }, throttleMs)) - // 无目录就直接返回空 - if (!toc || toc.length < 1) { - return <> - } - return
    目录
    diff --git a/themes/hexo/components/CategoryGroup.js b/themes/hexo/components/CategoryGroup.js index c88df60a..3b16739a 100644 --- a/themes/hexo/components/CategoryGroup.js +++ b/themes/hexo/components/CategoryGroup.js @@ -9,23 +9,17 @@ const CategoryGroup = ({ currentCategory, categories }) => {
    {categories.map(category => { const selected = currentCategory === category.name - return ( - - -
    {category.name}({category.count})
    - - - ); + return + +
    {category.name}({category.count})
    +
    + })}
    - ; + } export default CategoryGroup diff --git a/themes/hexo/components/HeaderArticle.js b/themes/hexo/components/HeaderArticle.js index 11c231b9..8ebfe2bd 100644 --- a/themes/hexo/components/HeaderArticle.js +++ b/themes/hexo/components/HeaderArticle.js @@ -32,7 +32,7 @@ export default function HeaderArticle({ post, siteInfo }) {
    {post.category && <> - +
    {post.category} @@ -46,10 +46,10 @@ export default function HeaderArticle({ post, siteInfo }) { - - {locale.COMMON.POST_TIME}:{date} - + > + + {locale.COMMON.POST_TIME}: {date} + )} @@ -65,5 +65,5 @@ export default function HeaderArticle({ post, siteInfo }) {
    - ); + ) } diff --git a/themes/hexo/components/HexoRecentComments.js b/themes/hexo/components/HexoRecentComments.js index 9c2042e6..d4cbacab 100644 --- a/themes/hexo/components/HexoRecentComments.js +++ b/themes/hexo/components/HexoRecentComments.js @@ -24,22 +24,20 @@ const HexoRecentComments = (props) => { }) }, []) - return ( - -
    - - {locale.COMMON.RECENT_COMMENTS} -
    + return +
    + + {locale.COMMON.RECENT_COMMENTS} +
    - {onLoading &&
    Loading...
    } - {!onLoading && comments && comments.length === 0 &&
    No Comments
    } - {!onLoading && comments && comments.length > 0 && comments.map((comment) =>
    -
    -
    --{comment.nick}
    -
    )} + {onLoading &&
    Loading...
    } + {!onLoading && comments && comments.length === 0 &&
    No Comments
    } + {!onLoading && comments && comments.length > 0 && comments.map((comment) =>
    + )} - - ); + } export default HexoRecentComments diff --git a/themes/hexo/components/LatestPostsGroup.js b/themes/hexo/components/LatestPostsGroup.js index a6741fc2..96eda369 100644 --- a/themes/hexo/components/LatestPostsGroup.js +++ b/themes/hexo/components/LatestPostsGroup.js @@ -18,47 +18,49 @@ const LatestPostsGroup = ({ latestPosts, siteInfo }) => { return <> } - return <> -
    -
    - - {locale.COMMON.LATEST_POSTS} + return ( + <> +
    +
    + + {locale.COMMON.LATEST_POSTS} +
    -
    - {latestPosts.map(post => { - const selected = currentPath === `${BLOG.SUB_PATH}/${post.slug}` - const headerImage = post?.page_cover - ? `url("${post.page_cover}")` - : `url("${siteInfo?.pageCover}")` + {latestPosts.map(post => { + const selected = currentPath === `${BLOG.SUB_PATH}/${post.slug}` + const headerImage = post?.page_cover + ? `url("${post.page_cover}")` + : `url("${siteInfo?.pageCover}")` - return ( - ( - -
    -
    -
    -
    {post.title}
    -
    {post.lastEditedTime}
    -
    -
    - - ) - ); - })} - ; + +
    +
    +
    +
    {post.title}
    +
    {post.lastEditedTime}
    +
    +
    +
    + + ) + })} + + ) } export default LatestPostsGroup diff --git a/themes/hexo/components/Logo.js b/themes/hexo/components/Logo.js index 61408026..2bfc6ea7 100644 --- a/themes/hexo/components/Logo.js +++ b/themes/hexo/components/Logo.js @@ -4,12 +4,10 @@ import React from 'react' const Logo = props => { const { siteInfo } = props - return ( - -
    -
    {siteInfo?.title || BLOG.TITLE}
    -
    - - ); + return +
    +
    {siteInfo?.title || BLOG.TITLE}
    +
    + } export default Logo diff --git a/themes/hexo/components/MenuButtonGroupTop.js b/themes/hexo/components/MenuButtonGroupTop.js index f6ae7a29..5d455c0b 100644 --- a/themes/hexo/components/MenuButtonGroupTop.js +++ b/themes/hexo/components/MenuButtonGroupTop.js @@ -18,30 +18,21 @@ const MenuButtonGroupTop = (props) => { links = links.concat(customNav) } - return ( - - ); + return } export default MenuButtonGroupTop diff --git a/themes/hexo/components/MenuGroupCard.js b/themes/hexo/components/MenuGroupCard.js index 1641023a..57c8375b 100644 --- a/themes/hexo/components/MenuGroupCard.js +++ b/themes/hexo/components/MenuGroupCard.js @@ -16,30 +16,21 @@ const MenuGroupCard = (props) => { { name: locale.COMMON.TAGS, to: '/tag', slot: tagSlot, show: CONFIG_HEXO.MENU_TAG } ] - return ( - - ); + return } export default MenuGroupCard diff --git a/themes/hexo/components/MenuList.js b/themes/hexo/components/MenuList.js index e5579a6a..bbab4a1b 100644 --- a/themes/hexo/components/MenuList.js +++ b/themes/hexo/components/MenuList.js @@ -21,32 +21,24 @@ const MenuList = (props) => { links = links.concat(customNav) } - return ( - - ); + return } export default MenuList diff --git a/themes/hexo/components/NavButtonGroup.js b/themes/hexo/components/NavButtonGroup.js index d490cd7b..f15b992d 100644 --- a/themes/hexo/components/NavButtonGroup.js +++ b/themes/hexo/components/NavButtonGroup.js @@ -13,21 +13,12 @@ const NavButtonGroup = (props) => { return <> } - return ( - - ); + return } export default NavButtonGroup diff --git a/themes/hexo/components/PaginationNumber.js b/themes/hexo/components/PaginationNumber.js index 0eb0b001..fba781e2 100644 --- a/themes/hexo/components/PaginationNumber.js +++ b/themes/hexo/components/PaginationNumber.js @@ -16,57 +16,51 @@ const PaginationNumber = ({ page, totalPage }) => { const pages = generatePages(pagePrefix, page, currentPage, totalPage) return ( -
    - {/* 上一页 */} - +
    + {/* 上一页 */} + + + - + {pages} - - - {pages} - - {/* 下一页 */} - - - - - -
    - ); + {/* 下一页 */} + + + +
    + ) } function getPageElement(page, currentPage, pagePrefix) { return ( - ( - - {page} - - ) - ); + + + {page} + + + ) } function generatePages(pagePrefix, page, currentPage, totalPage) { diff --git a/themes/hexo/components/TagItemMini.js b/themes/hexo/components/TagItemMini.js index 32221ea4..aa3388ec 100644 --- a/themes/hexo/components/TagItemMini.js +++ b/themes/hexo/components/TagItemMini.js @@ -1,21 +1,15 @@ import Link from 'next/link' const TagItemMini = ({ tag, selected = false }) => { - return ( - - -
    {selected && } {tag.name + (tag.count ? `(${tag.count})` : '')}
    - - - ); + return + +
    {selected && } {tag.name + (tag.count ? `(${tag.count})` : '')}
    +
    + } export default TagItemMini diff --git a/themes/hexo/components/TopNav.js b/themes/hexo/components/TopNav.js index 6555a27f..fec458eb 100644 --- a/themes/hexo/components/TopNav.js +++ b/themes/hexo/components/TopNav.js @@ -90,13 +90,10 @@ const TopNav = props => {
    {locale.COMMON.CATEGORY}
    - - - {locale.COMMON.MORE} - + + + {locale.COMMON.MORE} +
    @@ -107,13 +104,10 @@ const TopNav = props => {
    {locale.COMMON.TAGS}
    - - - {locale.COMMON.MORE} - + + + {locale.COMMON.MORE} +
    diff --git a/themes/matery/LayoutCategory.js b/themes/matery/LayoutCategory.js index 7b57c3c0..d7c72799 100644 --- a/themes/matery/LayoutCategory.js +++ b/themes/matery/LayoutCategory.js @@ -7,32 +7,30 @@ import HeaderArticle from './components/HeaderArticle' export const LayoutCategory = props => { const { category, categories } = props - return ( - } > + return } > -
    +
    -
    +
    -
    - {categories.map(e => { - const selected = e.name === category - return ( - -
    - - {e.name}({e.count}) -
    - - ); - })} -
    +
    + {categories.map(e => { + const selected = e.name === category + return ( + +
    + + {e.name}({e.count}) +
    + + ) + })}
    - - {BLOG.POST_LIST_STYLE === 'page' ? : } -
    - - ); + {BLOG.POST_LIST_STYLE === 'page' ? : } + +
    + + } diff --git a/themes/matery/LayoutCategoryIndex.js b/themes/matery/LayoutCategoryIndex.js index ab98d3a4..99c0f582 100644 --- a/themes/matery/LayoutCategoryIndex.js +++ b/themes/matery/LayoutCategoryIndex.js @@ -6,27 +6,27 @@ export const LayoutCategoryIndex = props => { const { categories } = props return ( - } > + } > -
    +
    -
    +
    -
    - {categories.map(e => { - return ( - -
    - - {e.name}({e.count}) -
    - - ) - })} -
    -
    +
    + {categories.map(e => { + return ( + +
    + + {e.name}({e.count}) +
    + + ) + })} +
    +
    -
    - +
    +
    ) } diff --git a/themes/matery/LayoutSearch.js b/themes/matery/LayoutSearch.js index db528a29..bed5cefc 100644 --- a/themes/matery/LayoutSearch.js +++ b/themes/matery/LayoutSearch.js @@ -38,62 +38,62 @@ export const LayoutSearch = props => { }, 100) }) return ( - - {!currentSearch && <> -
    - - {/* 分类 */} - -
    - - {locale.COMMON.CATEGORY}: -
    -
    - {categories?.map(category => { - return ( - -
    + {!currentSearch && <> +
    + + {/* 分类 */} + +
    + + {locale.COMMON.CATEGORY}: +
    +
    + {categories?.map(category => { + return ( + - - {category.name}({category.count}) +
    + + {category.name}({category.count}) +
    + + ) + })} +
    +
    + {/* 标签 */} + +
    + + {locale.COMMON.TAGS}: +
    +
    + {tags?.map(tag => { + return ( +
    +
    - - ) - })} -
    -
    - {/* 标签 */} - -
    - - {locale.COMMON.TAGS}: -
    -
    - {tags?.map(tag => { - return ( -
    - -
    - ) - })} -
    -
    -
    - } + ) + })} +
    + +
    + } - {currentSearch && <> -
    - {BLOG.POST_LIST_STYLE === 'page' ? : } -
    - } + {currentSearch && <> +
    + {BLOG.POST_LIST_STYLE === 'page' ? : } +
    + } - + ) } diff --git a/themes/matery/LayoutSlug.js b/themes/matery/LayoutSlug.js index 6e95ff52..a6a79e7b 100644 --- a/themes/matery/LayoutSlug.js +++ b/themes/matery/LayoutSlug.js @@ -45,7 +45,7 @@ export const LayoutSlug = props => { >
    -
    +
    {lock && } @@ -112,7 +112,7 @@ export const LayoutSlug = props => { data-aos-once="false" data-aos-anchor-placement="top-center" className='relative h-full'> -
    +
    diff --git a/themes/matery/components/ArticleCopyright.js b/themes/matery/components/ArticleCopyright.js index e5b56411..e3456747 100644 --- a/themes/matery/components/ArticleCopyright.js +++ b/themes/matery/components/ArticleCopyright.js @@ -16,26 +16,24 @@ export default function ArticleCopyright () { }) const { locale } = useGlobal() - return ( -
    -
      -
    • - {locale.COMMON.AUTHOR}: - - {BLOG.AUTHOR} - -
    • -
    • - {locale.COMMON.URL}: - - {path} - -
    • -
    • - {locale.COMMON.COPYRIGHT}: - {locale.COMMON.COPYRIGHT_NOTICE} -
    • -
    -
    - ); + return
    +
      +
    • + {locale.COMMON.AUTHOR}: + + {BLOG.AUTHOR} + +
    • +
    • + {locale.COMMON.URL}: + + {path} + +
    • +
    • + {locale.COMMON.COPYRIGHT}: + {locale.COMMON.COPYRIGHT_NOTICE} +
    • +
    +
    } diff --git a/themes/matery/components/ArticleInfo.js b/themes/matery/components/ArticleInfo.js index 1a4c9a4a..892e1c3e 100644 --- a/themes/matery/components/ArticleInfo.js +++ b/themes/matery/components/ArticleInfo.js @@ -10,38 +10,36 @@ export const ArticleInfo = (props) => { const { locale } = useGlobal() const date = formatDate(post?.date?.start_date || post?.createdTime, locale.LOCALE) - return ( -
    -
    - {post.tagItems && ( -
    - {post.tagItems.map(tag => ( - - ))} -
    - )} -
    + return
    +
    + {post.tagItems && ( +
    + {post.tagItems.map(tag => ( + + ))} +
    + )} +
    -
    - {post?.type !== 'Page' && (<> - +
    + {post?.type !== 'Page' && (<> + + + 发布日期: {date} + + + + 更新日期: {post.lastEditedTime} + + + + + + )} +
    - 发布日期:{date} - - - - 更新日期: {post.lastEditedTime} - - - - - - )} -
    - -
    - ); +
    } diff --git a/themes/matery/components/ArticleRecommend.js b/themes/matery/components/ArticleRecommend.js index ed87337e..428b7afa 100644 --- a/themes/matery/components/ArticleRecommend.js +++ b/themes/matery/components/ArticleRecommend.js @@ -34,32 +34,35 @@ export default function ArticleRecommend({ recommendPosts, siteInfo }) { : `url("${siteInfo?.pageCover}")` return ( - ( - -
    + - - ); + ) } diff --git a/themes/matery/components/BlogPostArchive.js b/themes/matery/components/BlogPostArchive.js index 20887d45..227a2697 100644 --- a/themes/matery/components/BlogPostArchive.js +++ b/themes/matery/components/BlogPostArchive.js @@ -29,20 +29,17 @@ const BlogPostArchive = ({ posts = [], archiveTitle }) => {
    {post.date?.start_date}{' '}   - - - {post.title} - + + + {post.title} +
    ))}
    - ); + ) } } diff --git a/themes/matery/components/BlogPostCard.js b/themes/matery/components/BlogPostCard.js index 0f901a71..fbe24de5 100644 --- a/themes/matery/components/BlogPostCard.js +++ b/themes/matery/components/BlogPostCard.js @@ -7,83 +7,80 @@ import CONFIG_MATERY from '../config_matery' const BlogPostCard = ({ post, showSummary }) => { const showPreview = CONFIG_MATERY.POST_LIST_PREVIEW && post.blockMap return ( -
    +
    - {/* 固定高度 ,空白用图片拉升填充 */} -
    + {/* 固定高度 ,空白用图片拉升填充 */} +
    - {/* 头部图片 填充卡片 */} - {CONFIG_MATERY.POST_LIST_COVER && !showPreview && post?.page_cover && ( - -
    - {/* eslint-disable-next-line @next/next/no-img-element */} - {post.title} - {post.title} -
    - - )} + {/* 头部图片 填充卡片 */} + {CONFIG_MATERY.POST_LIST_COVER && !showPreview && post?.page_cover && ( + +
    + {/* eslint-disable-next-line @next/next/no-img-element */} + {post.title} + {post.title} +
    + + )} -
    - {/* 描述 */} -
    +
    + {/* 描述 */} +
    - {(!showPreview || showSummary) && post.summary && ( -

    - {post.summary} -

    - )} + {(!showPreview || showSummary) && post.summary && ( +

    + {post.summary} +

    + )} - - - {post.date?.start_date || post.lastEditedTime} + {post?.tagItems && post?.tagItems.length > 0 && (<> +
    +
    +
    +
    + {' '} + {post.tagItems.map(tag => ( + + ))} +
    +
    +
    + )} +
    +
    - - - - - {post.category} - - -
    -
    - - {post?.tagItems && post?.tagItems.length > 0 && (<> -
    -
    -
    -
    - {' '} - {post.tagItems.map(tag => ( - - ))} -
    -
    -
    - )} -
    -
    - -
    - ); +
    + ) } export default BlogPostCard diff --git a/themes/matery/components/Catalog.js b/themes/matery/components/Catalog.js index f58aa9fb..3104e338 100644 --- a/themes/matery/components/Catalog.js +++ b/themes/matery/components/Catalog.js @@ -58,12 +58,12 @@ const Catalog = ({ toc }) => { return <> } - return
    + return
    目录
    -
    +
    + {post.type === 'Post' && } + } - {/* 评论互动 */} -
    - -
    + {/* 评论互动 */} +
    +
    -
    - ); + +
    ) } diff --git a/themes/next/components/BlogAround.js b/themes/next/components/BlogAround.js index 69948b24..9e5f3d6f 100644 --- a/themes/next/components/BlogAround.js +++ b/themes/next/components/BlogAround.js @@ -9,24 +9,16 @@ export default function BlogAround ({ prev, next }) { if (!prev || !next) { return <> } - return ( -
    - {prev && - + return
    + {prev && + {prev.title} - - } - {next && - {next.title} + + } + {next && + {next.title} - - } -
    - ); + + } +
    } diff --git a/themes/next/components/BlogPostArchive.js b/themes/next/components/BlogPostArchive.js index 91f5527a..65049ce4 100644 --- a/themes/next/components/BlogPostArchive.js +++ b/themes/next/components/BlogPostArchive.js @@ -29,20 +29,17 @@ const BlogPostArchive = ({ posts = [], archiveTitle }) => {
    {post.date?.start_date}{' '}   - - - {post.title} - + + + {post.title} +
    ))}
    - ); + ) } } diff --git a/themes/next/components/BlogPostCard.js b/themes/next/components/BlogPostCard.js index 65352c12..1513118d 100644 --- a/themes/next/components/BlogPostCard.js +++ b/themes/next/components/BlogPostCard.js @@ -19,14 +19,13 @@ const BlogPostCard = ({ post, showSummary }) => { className="flex flex-col-reverse justify-between duration-300" >
    - - - {post.title} - + + + {post.title} +
    {
    {post.category && ( <> - - - - {post.category} - + + + + {post.category} + | @@ -51,10 +47,10 @@ const BlogPostCard = ({ post, showSummary }) => { - - {post.date?.start_date} - + > + + {post.date?.start_date} +
    @@ -89,19 +85,17 @@ const BlogPostCard = ({ post, showSummary }) => { )}
    - - - {locale.COMMON.ARTICLE_DETAIL} - - + + + {locale.COMMON.ARTICLE_DETAIL} + +
    {CONFIG_NEXT.POST_LIST_COVER && post?.page_cover && ( - +
    { )}
    - ); + ) } export default BlogPostCard diff --git a/themes/next/components/CategoryGroup.js b/themes/next/components/CategoryGroup.js index 8e24231a..1c22d04e 100644 --- a/themes/next/components/CategoryGroup.js +++ b/themes/next/components/CategoryGroup.js @@ -7,22 +7,17 @@ const CategoryGroup = ({ currentCategory, categories }) => {
    {categories.map(category => { const selected = currentCategory === category.name - return ( - - + return + {category.name}({category.count}) - - ); + + })}
    - ; + } export default CategoryGroup diff --git a/themes/next/components/CategoryList.js b/themes/next/components/CategoryList.js index 2d384479..5390a769 100644 --- a/themes/next/components/CategoryList.js +++ b/themes/next/components/CategoryList.js @@ -8,34 +8,27 @@ const CategoryList = ({ currentCategory, categories }) => { } const { locale } = useGlobal() - return ( - - ); + return } export default CategoryList diff --git a/themes/next/components/ContactButton.js b/themes/next/components/ContactButton.js index b9e0a75b..4744f81a 100644 --- a/themes/next/components/ContactButton.js +++ b/themes/next/components/ContactButton.js @@ -8,17 +8,15 @@ import Link from 'next/link' */ const ContactButton = () => { return ( - ( - + + - - ) - ); + + + ) } export default ContactButton diff --git a/themes/next/components/LatestPostsGroup.js b/themes/next/components/LatestPostsGroup.js index 7b0f9012..79de1c5c 100644 --- a/themes/next/components/LatestPostsGroup.js +++ b/themes/next/components/LatestPostsGroup.js @@ -18,38 +18,40 @@ const LatestPostsGroup = ({ latestPosts }) => { return <> } - return <> -
    -
    - - {locale.COMMON.LATEST_POSTS} + return ( + <> +
    +
    + + {locale.COMMON.LATEST_POSTS} +
    -
    - {latestPosts.map(post => { - const selected = currentPath === `${BLOG.SUB_PATH}/${post.slug}` - return ( - ( - -
    { + const selected = currentPath === `${BLOG.SUB_PATH}/${post.slug}` + return ( + -
  • {post.title}
  • -
    - - ) - ); - })} - ; + +
    +
  • {post.title}
  • +
    +
    + + ) + })} + + ) } export default LatestPostsGroup diff --git a/themes/next/components/Logo.js b/themes/next/components/Logo.js index d78e523c..f53ff0c0 100644 --- a/themes/next/components/Logo.js +++ b/themes/next/components/Logo.js @@ -3,13 +3,11 @@ import React from 'react' const Logo = props => { const { siteInfo, className } = props - return ( - -
    -
    {siteInfo?.title}
    -
    {siteInfo?.description}
    -
    - - ); + return +
    +
    {siteInfo?.title}
    +
    {siteInfo?.description}
    +
    + } export default Logo diff --git a/themes/next/components/MenuButtonGroup.js b/themes/next/components/MenuButtonGroup.js index b2c266da..0afb83be 100644 --- a/themes/next/components/MenuButtonGroup.js +++ b/themes/next/components/MenuButtonGroup.js @@ -21,33 +21,24 @@ const MenuButtonGroup = (props) => { links = defaultLinks.concat(customNav) } - return ( - - ); + return } export default MenuButtonGroup diff --git a/themes/next/components/NextRecentComments.js b/themes/next/components/NextRecentComments.js index 34ae9b3c..81e9845d 100644 --- a/themes/next/components/NextRecentComments.js +++ b/themes/next/components/NextRecentComments.js @@ -26,10 +26,10 @@ const NextRecentComments = (props) => { {!onLoading && comments && comments.length === 0 &&
    No Comments
    } {!onLoading && comments && comments.length > 0 && comments.map((comment) =>
    -
    --{comment.nick}
    +
    )} - ; + } export default NextRecentComments diff --git a/themes/next/components/PaginationNumber.js b/themes/next/components/PaginationNumber.js index c805b8a8..323a3eb0 100644 --- a/themes/next/components/PaginationNumber.js +++ b/themes/next/components/PaginationNumber.js @@ -16,72 +16,68 @@ const PaginationNumber = ({ page, totalPage }) => { const pages = generatePages(pagePrefix, page, currentPage, totalPage) return ( -
    - {/* 上一页 */} - - - + + - {pages} + {pages} - {/* 下一页 */} - - - -
    - ); + + +
    + ) } function getPageElement(pagePrefix, page, currentPage) { return ( - ( - - {page} - - ) - ); + + + {page} + + + ) } function generatePages(pagePrefix, page, currentPage, totalPage) { const pages = [] diff --git a/themes/next/components/PaginationSimple.js b/themes/next/components/PaginationSimple.js index 68b0b5cb..4edb7b7c 100644 --- a/themes/next/components/PaginationSimple.js +++ b/themes/next/components/PaginationSimple.js @@ -31,7 +31,7 @@ const PaginationSimple = ({ page, showNext }) => { query: router.query.s ? { s: router.query.s } : {} }} passHref - legacyBehavior> + >
    - ); + ) } export default PaginationSimple diff --git a/themes/next/components/RecommendPosts.js b/themes/next/components/RecommendPosts.js index 7e680da5..d35c65ae 100644 --- a/themes/next/components/RecommendPosts.js +++ b/themes/next/components/RecommendPosts.js @@ -18,15 +18,15 @@ const RecommendPosts = ({ recommendPosts }) => {
    - ); + ) } export default RecommendPosts diff --git a/themes/next/components/SideAreaRight.js b/themes/next/components/SideAreaRight.js index 8d180cb6..e543d20f 100644 --- a/themes/next/components/SideAreaRight.js +++ b/themes/next/components/SideAreaRight.js @@ -26,77 +26,71 @@ const SideAreaRight = (props) => { const router = useRouter() return ( +
    + ) } export default SideAreaRight diff --git a/themes/next/components/SideBar.js b/themes/next/components/SideBar.js index 8525859a..a90c5c3d 100644 --- a/themes/next/components/SideBar.js +++ b/themes/next/components/SideBar.js @@ -19,69 +19,61 @@ import React from 'react' const SideBar = (props) => { const { tags, currentTag, post, slot, categories, currentCategory } = props const { locale } = useGlobal() - return ( -
    + +
    + {/* 信息流广告 */} + +
    + + } export default SideBar diff --git a/themes/next/components/TagItem.js b/themes/next/components/TagItem.js index 85f6e0be..000b2d72 100644 --- a/themes/next/components/TagItem.js +++ b/themes/next/components/TagItem.js @@ -8,20 +8,17 @@ const TagItem = ({ tag, selected }) => {
    { locale.COMMON.NOTAG }
    } return ( - -
  • -
    - {selected && } {`${tag.name} `} {tag.count ? `(${tag.count})` : ''} -
    -
  • - - ); + +
  • +
    + {selected && } {`${tag.name} `} {tag.count ? `(${tag.count})` : ''} +
    +
  • + + ) } export default TagItem diff --git a/themes/next/components/TagItemMini.js b/themes/next/components/TagItemMini.js index 72f12959..914cd9a0 100644 --- a/themes/next/components/TagItemMini.js +++ b/themes/next/components/TagItemMini.js @@ -1,21 +1,15 @@ import Link from 'next/link' const TagItemMini = ({ tag, selected = false }) => { - return ( - - -
    {selected && } {tag.name + (tag.count ? `(${tag.count})` : '')}
    - - - ); + return + +
    {selected && } {tag.name + (tag.count ? `(${tag.count})` : '')}
    +
    + } export default TagItemMini diff --git a/themes/next/components/TopNav.js b/themes/next/components/TopNav.js index 148f89ca..5fbd4e5a 100644 --- a/themes/next/components/TopNav.js +++ b/themes/next/components/TopNav.js @@ -57,13 +57,10 @@ const TopNav = (props) => {
    {locale.COMMON.CATEGORY}
    - - - {locale.COMMON.MORE} - + + + {locale.COMMON.MORE} +
    @@ -74,13 +71,10 @@ const TopNav = (props) => {
    {locale.COMMON.TAGS}
    - - - {locale.COMMON.MORE} - + + + {locale.COMMON.MORE} +
    diff --git a/themes/nobelium/LayoutArchive.js b/themes/nobelium/LayoutArchive.js index c5b3a8ba..b85860e0 100644 --- a/themes/nobelium/LayoutArchive.js +++ b/themes/nobelium/LayoutArchive.js @@ -45,10 +45,10 @@ export const LayoutArchive = props => { - - {post.title} - + > + + {post.title} +
    @@ -58,5 +58,5 @@ export const LayoutArchive = props => { ))}
    - ); + ) } diff --git a/themes/nobelium/LayoutCategoryIndex.js b/themes/nobelium/LayoutCategoryIndex.js index 6d1884ab..28b98b6e 100644 --- a/themes/nobelium/LayoutCategoryIndex.js +++ b/themes/nobelium/LayoutCategoryIndex.js @@ -4,24 +4,16 @@ import LayoutBase from './LayoutBase' export const LayoutCategoryIndex = (props) => { const { categories } = props - return ( - -
    - {categories && categories.map(category => { - return ( - -
    - {category.name}({category.count}) -
    - - ); - })} -
    -
    - ); + return +
    + {categories && categories.map(category => { + return +
    + {category.name}({category.count}) +
    + + })} +
    +
    } diff --git a/themes/nobelium/LayoutTagIndex.js b/themes/nobelium/LayoutTagIndex.js index 6d2873a8..6a89e168 100644 --- a/themes/nobelium/LayoutTagIndex.js +++ b/themes/nobelium/LayoutTagIndex.js @@ -3,27 +3,19 @@ import LayoutBase from './LayoutBase' export const LayoutTagIndex = (props) => { const { tags } = props - return ( - -
    -
    - {tags.map(tag => { - return ( -
    - - -
    {tag.name + (tag.count ? `(${tag.count})` : '')}
    - - -
    - ); - })} -
    -
    - ); + return +
    +
    + {tags.map(tag => { + return + })} +
    +
    } diff --git a/themes/nobelium/components/BlogListPage.js b/themes/nobelium/components/BlogListPage.js index 4dd1fff6..266d14e3 100644 --- a/themes/nobelium/components/BlogListPage.js +++ b/themes/nobelium/components/BlogListPage.js @@ -16,35 +16,29 @@ export const BlogListPage = props => { const showNext = page < totalPage const pagePrefix = router.asPath.replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '') - return ( -
    + return
    -
    - {posts?.map(post => ( - - ))} -
    - - - ); +
    } diff --git a/themes/nobelium/components/BlogListScroll.js b/themes/nobelium/components/BlogListScroll.js index d70e4bc5..c9859c0b 100644 --- a/themes/nobelium/components/BlogListScroll.js +++ b/themes/nobelium/components/BlogListScroll.js @@ -43,40 +43,36 @@ export const BlogListScroll = props => { } }) - return ( -
    - {postsToShow.map(p => ( -
    -

    - - {p.title} - -

    + return
    + {postsToShow.map(p => ( + - ))} - -
    - {' '} - {hasMore ? locale.COMMON.MORE : `${locale.COMMON.NO_MORE} 😰`}{' '} -
    +

    + {p.summary} +

    +
    + ))} +
    + {' '} + {hasMore ? locale.COMMON.MORE : `${locale.COMMON.NO_MORE} 😰`}{' '}
    - ); + +
    } diff --git a/themes/nobelium/components/BlogPost.js b/themes/nobelium/components/BlogPost.js index 9cd717b5..b0a99330 100644 --- a/themes/nobelium/components/BlogPost.js +++ b/themes/nobelium/components/BlogPost.js @@ -4,26 +4,26 @@ import formatDate from '@/lib/formatDate' const BlogPost = ({ post }) => { return ( - ( - -
    -
    -

    - {post.title} -

    - -
    -
    -

    - {post.summary} -

    -
    -
    - - ) - ); + + +
    +
    +

    + {post.title} +

    + +
    +
    +

    + {post.summary} +

    +
    +
    +
    + + ) } export default BlogPost diff --git a/themes/nobelium/components/ExampleRecentComments.js b/themes/nobelium/components/ExampleRecentComments.js index 42c8805e..e1fe86ca 100644 --- a/themes/nobelium/components/ExampleRecentComments.js +++ b/themes/nobelium/components/ExampleRecentComments.js @@ -26,10 +26,10 @@ const ExampleRecentComments = (props) => { {!onLoading && comments && comments.length === 0 &&
    No Comments
    } {!onLoading && comments && comments.length > 0 && comments.map((comment) =>
    -
    --{comment.nick}
    +
    )} - ; + } export default ExampleRecentComments diff --git a/themes/nobelium/components/Nav.js b/themes/nobelium/components/Nav.js index 9db2e524..178d0399 100644 --- a/themes/nobelium/components/Nav.js +++ b/themes/nobelium/components/Nav.js @@ -27,65 +27,67 @@ const Nav = ({ navBarTitle, fullWidth }) => { // } // eslint-disable-next-line react-hooks/exhaustive-deps }, [sentinalRef]) - return <> -
    -