diff --git a/.env.local b/.env.local index a5695000..2d0e2eba 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.7.3 +NEXT_PUBLIC_VERSION=3.8.0 diff --git a/blog.config.js b/blog.config.js index 5250e8ef..8be17f3f 100644 --- a/blog.config.js +++ b/blog.config.js @@ -30,6 +30,9 @@ const BLOG = { CUSTOM_FONT_SANS: ['LXGW WenKai'], // 自定义无衬线字体 CUSTOM_FONT_SERIF: ['LXGW WenKai'], // 自定义衬线字体 + // 侧栏布局 是否反转(左变右,右变左) 已支持主题: hexo next medium fukasawa example + LAYOUT_SIDEBAR_REVERSE: false, + // 一个小插件展示你的facebook fan page~ @see https://tw.andys.pro/article/add-facebook-fanpage-notionnext FACEBOOK_PAGE_TITLE: process.env.NEXT_PUBLIC_FACEBOOK_PAGE_TITLE || null, // 邊欄 Facebook Page widget 的標題欄,填''則無標題欄 e.g FACEBOOK 粉絲團' FACEBOOK_PAGE: process.env.NEXT_PUBLIC_FACEBOOK_PAGE || null, // Facebook Page 的連結 e.g https://www.facebook.com/tw.andys.pro @@ -59,7 +62,7 @@ const BLOG = { PREVIEW_TAG_COUNT: 16, // 首页最多展示的标签数量,0为不限制 // 鼠标点击烟花特效 - FIREWORKS: process.env.NEXT_PUBLIC_FIREWORKS || true, // 鼠标点击烟花特效 + FIREWORKS: process.env.NEXT_PUBLIC_FIREWORKS || true, // 开关 // 烟花色彩,感谢 https://github.com/Vixcity 提交的色彩 FIREWORKS_COLOR: ['255, 20, 97', '24, 255, 146', '90, 135, 255', '251, 243, 140'], diff --git a/components/ThemeSwitch.js b/components/ThemeSwitch.js index 17973c04..d9d8b9b6 100644 --- a/components/ThemeSwitch.js +++ b/components/ThemeSwitch.js @@ -19,10 +19,9 @@ export function ThemeSwitch() {
{/*
{theme}
*/} - {ALL_THEME.map(t => { - const selected = t === theme - return + return })}
diff --git a/next.config.js b/next.config.js index f2a86bc5..fb92a754 100644 --- a/next.config.js +++ b/next.config.js @@ -3,9 +3,6 @@ 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 8e401fc8..c83a29c2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "notion-next", - "version": "3.7.3", + "version": "3.8.0", "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": "12.1.6", + "next": "^13.1.1", "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": "17.0.2", + "react": "^18.2.0", "react-cookies": "^0.1.1", "react-cusdis": "^2.1.3", - "react-dom": "17.0.2", + "react-dom": "^18.2.0", "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": "^11.0.0", + "eslint-config-next": "^13.1.1", "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 43172bfb..d63b1e5e 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 3013696d..e5607ed7 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 } + const meta = { title: `${props?.siteInfo?.title || BLOG.TITLE} | loading`, image: siteInfo?.pageCover || BLOG.HOME_BANNER_IMAGE } return } diff --git a/styles/notion.css b/styles/notion.css index 9ec0e222..85b07df8 100644 --- a/styles/notion.css +++ b/styles/notion.css @@ -407,6 +407,12 @@ margin-top: 1.08em; @apply border-b w-full } +.notion-h2 { + @apply w-full +} +.notion-h3 { + @apply w-full +} .notion-header-anchor { position: absolute; diff --git a/themes/example/LayoutArchive.js b/themes/example/LayoutArchive.js index b85860e0..a89265f3 100644 --- a/themes/example/LayoutArchive.js +++ b/themes/example/LayoutArchive.js @@ -45,10 +45,10 @@ export const LayoutArchive = props => { - - {post.title} - + className="dark:text-gray-400 dark:hover:text-gray-300 overflow-x-hidden hover:underline cursor-pointer text-gray-600"> + + {post.title} + diff --git a/themes/example/LayoutCategoryIndex.js b/themes/example/LayoutCategoryIndex.js index 28b98b6e..1230c20f 100644 --- a/themes/example/LayoutCategoryIndex.js +++ b/themes/example/LayoutCategoryIndex.js @@ -4,16 +4,24 @@ 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 6a89e168..6d2873a8 100644 --- a/themes/example/LayoutTagIndex.js +++ b/themes/example/LayoutTagIndex.js @@ -3,19 +3,27 @@ import LayoutBase from './LayoutBase' export const LayoutTagIndex = (props) => { const { tags } = props - return -
-
- {tags.map(tag => { - return - })} -
-
+ return ( + +
+
+ {tags.map(tag => { + return ( +
+ + +
{tag.name + (tag.count ? `(${tag.count})` : '')}
+ + +
+ ); + })} +
+
+ ); } diff --git a/themes/example/components/ArticleInfo.js b/themes/example/components/ArticleInfo.js index 7317d533..0b34fb12 100644 --- a/themes/example/components/ArticleInfo.js +++ b/themes/example/components/ArticleInfo.js @@ -8,40 +8,45 @@ 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 c98ccd54..390bf90a 100644 --- a/themes/example/components/BlogListPage.js +++ b/themes/example/components/BlogListPage.js @@ -15,47 +15,55 @@ 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.results && ( -

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

+ {p.summary}

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

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

+ )} +
+ ))} +
-
- - {locale.PAGINATION.PREV} - - - {locale.PAGINATION.NEXT} - +
+ + {locale.PAGINATION.PREV} + + + {locale.PAGINATION.NEXT} + +
-
+ ); } diff --git a/themes/example/components/BlogListScroll.js b/themes/example/components/BlogListScroll.js index c9859c0b..d70e4bc5 100644 --- a/themes/example/components/BlogListScroll.js +++ b/themes/example/components/BlogListScroll.js @@ -43,36 +43,40 @@ export const BlogListScroll = props => { } }) - return
- {postsToShow.map(p => ( - + ))} + +
+ {' '} + {hasMore ? locale.COMMON.MORE : `${locale.COMMON.NO_MORE} 😰`}{' '} +
-
- {' '} - {hasMore ? locale.COMMON.MORE : `${locale.COMMON.NO_MORE} 😰`}{' '}
- -
+ ); } diff --git a/themes/example/components/ExampleRecentComments.js b/themes/example/components/ExampleRecentComments.js index e1fe86ca..42c8805e 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 424edcae..7c8355ae 100644 --- a/themes/example/components/Header.js +++ b/themes/example/components/Header.js @@ -7,15 +7,19 @@ import Link from 'next/link' export const Header = (props) => { const { siteInfo } = props - return
-
- - + return ( +
+
+ + {siteInfo?.title} - -
- {/* 右侧文字 */} + +
+ {/* 右侧文字 */} +
-
-
+
+ ); } diff --git a/themes/example/components/Nav.js b/themes/example/components/Nav.js index 26610035..5bfb8b2d 100644 --- a/themes/example/components/Nav.js +++ b/themes/example/components/Nav.js @@ -20,20 +20,25 @@ export const Nav = (props) => { links = links.concat(customNav) } - return + + ); } diff --git a/themes/example/components/SideBar.js b/themes/example/components/SideBar.js index ea45f851..986063b0 100644 --- a/themes/example/components/SideBar.js +++ b/themes/example/components/SideBar.js @@ -8,48 +8,58 @@ 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 d517d65c..e44e86dc 100644 --- a/themes/fukasawa/LayoutCategoryIndex.js +++ b/themes/fukasawa/LayoutCategoryIndex.js @@ -5,21 +5,29 @@ import LayoutBase from './LayoutBase' export const LayoutCategoryIndex = (props) => { const { locale } = useGlobal() const { categories } = props - return -
-
- {locale.COMMON.CATEGORY}: + return ( + +
+
+ {locale.COMMON.CATEGORY}: +
+
+ {categories && categories.map(category => { + return ( + +
+ {category.name}({category.count}) +
+ + ) + })} +
-
- {categories && categories.map(category => { - return -
- {category.name}({category.count}) -
- - })} -
-
- + + ) } diff --git a/themes/fukasawa/components/ArticleAround.js b/themes/fukasawa/components/ArticleAround.js index 1b145b33..b0de69c7 100644 --- a/themes/fukasawa/components/ArticleAround.js +++ b/themes/fukasawa/components/ArticleAround.js @@ -9,16 +9,24 @@ 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 9a939766..19968e72 100644 --- a/themes/fukasawa/components/ArticleDetail.js +++ b/themes/fukasawa/components/ArticleDetail.js @@ -17,86 +17,91 @@ 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} -
- )} -
- -
- - {/* 文章Title */} -
- {post.title} + return ( +
+ {post?.type && !post?.type !== 'Page' && post?.page_cover && ( +
+ {/* eslint-disable-next-line @next/next/no-img-element */} + {post.title}
+ )} +
-
-
+
- {post?.category && (<> - - - - {post.category} - - - | - )} - - {post?.type !== 'Page' && (<> - - - {date} - - - | - - {locale.COMMON.LAST_EDITED_TIME}: {post.lastEditedTime} - - )} - -
- -   - -
+ {/* 文章Title */} +
+ {post.title}
+
+
+ + {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 3cde4df0..1c42923f 100644 --- a/themes/fukasawa/components/BlogCard.js +++ b/themes/fukasawa/components/BlogCard.js @@ -13,13 +13,14 @@ const BlogCard = ({ post, showSummary }) => { className="animate__animated animate__fadeIn flex flex-col-reverse justify-between duration-300" >
- - - {post.title} - + + + {post.title} + {(!showPreview || showSummary) && ( @@ -30,7 +31,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 45c85ce1..c594d7d1 100644 --- a/themes/fukasawa/components/BlogPostArchive.js +++ b/themes/fukasawa/components/BlogPostArchive.js @@ -29,10 +29,13 @@ 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 fabc2e57..876a8f70 100644 --- a/themes/fukasawa/components/GroupCategory.js +++ b/themes/fukasawa/components/GroupCategory.js @@ -10,17 +10,22 @@ 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 906ef217..afaec0e2 100644 --- a/themes/fukasawa/components/GroupMenu.js +++ b/themes/fukasawa/components/GroupMenu.js @@ -20,24 +20,32 @@ 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 42cbc268..3b6720fb 100644 --- a/themes/fukasawa/components/Logo.js +++ b/themes/fukasawa/components/Logo.js @@ -2,11 +2,15 @@ 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 3c737b6d..cbbf23d0 100644 --- a/themes/fukasawa/components/PaginationSimple.js +++ b/themes/fukasawa/components/PaginationSimple.js @@ -26,15 +26,12 @@ 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 ef1139b5..18511426 100644 --- a/themes/fukasawa/components/TagItem.js +++ b/themes/fukasawa/components/TagItem.js @@ -8,17 +8,20 @@ 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 fb9efc58..26295088 100644 --- a/themes/fukasawa/components/TagItemMini.js +++ b/themes/fukasawa/components/TagItemMini.js @@ -1,15 +1,21 @@ 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 6d21da03..7d7165a6 100644 --- a/themes/hexo/LayoutCategoryIndex.js +++ b/themes/hexo/LayoutCategoryIndex.js @@ -16,7 +16,11 @@ 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}) -
    - - ) - })} -
    - - {/* 标签 */} - -
    - - {locale.COMMON.TAGS}: -
    -
    - {tags?.map(tag => { - return ( -
    - + + {category.name}({category.count})
    - ) - })} -
    -
    -
    - } + + ) + })} +
    + + {/* 标签 */} + +
    + + {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 1eb2c249..ec8fb6f9 100644 --- a/themes/hexo/LayoutTag.js +++ b/themes/hexo/LayoutTag.js @@ -10,17 +10,23 @@ export const LayoutTag = (props) => { return t.name === props.tag }) - return - {tag && ( -
    - - + return ( + + {tag && ( + - )} - {BLOG.POST_LIST_STYLE === 'page' ? : } - + + +
    + )} + {BLOG.POST_LIST_STYLE === 'page' ? : } +
    + ) } diff --git a/themes/hexo/components/ArticleAdjacent.js b/themes/hexo/components/ArticleAdjacent.js index f5d14574..6e1face7 100644 --- a/themes/hexo/components/ArticleAdjacent.js +++ b/themes/hexo/components/ArticleAdjacent.js @@ -10,16 +10,24 @@ 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 57151869..80ffd8c9 100644 --- a/themes/hexo/components/ArticleCopyright.js +++ b/themes/hexo/components/ArticleCopyright.js @@ -16,24 +16,26 @@ 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 af081a1c..30373f67 100644 --- a/themes/hexo/components/ArticleRecommend.js +++ b/themes/hexo/components/ArticleRecommend.js @@ -34,32 +34,29 @@ 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 227a2697..20887d45 100644 --- a/themes/hexo/components/BlogPostArchive.js +++ b/themes/hexo/components/BlogPostArchive.js @@ -29,17 +29,20 @@ 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 06f4d8c7..dd6cabde 100644 --- a/themes/hexo/components/BlogPostCard.js +++ b/themes/hexo/components/BlogPostCard.js @@ -20,13 +20,14 @@ 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} - + className="font-light hover:underline cursor-pointer text-sm leading-4 mr-3"> + + + {post.date?.start_date || post.lastEditedTime} +
    @@ -67,11 +68,14 @@ const BlogPostCard = ({ post, showSummary }) => { )}
    - - - - {post.category} - + + + + {post.category} +
    @@ -85,7 +89,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 c51ee499..9c80cd1a 100644 --- a/themes/hexo/components/Catalog.js +++ b/themes/hexo/components/Catalog.js @@ -10,10 +10,6 @@ import Progress from './Progress' * @constructor */ const Catalog = ({ toc }) => { - // 无目录就直接返回空 - if (!toc || toc.length < 1) { - return <> - } // 监听滚动事件 React.useEffect(() => { window.addEventListener('scroll', actionSectionScrollSpy) @@ -29,6 +25,7 @@ const Catalog = ({ toc }) => { // 同步选中目录事件 const [activeSection, setActiveSection] = React.useState(null) + const throttleMs = 100 const actionSectionScrollSpy = React.useCallback(throttle(() => { const sections = document.getElementsByClassName('notion-h') @@ -57,6 +54,11 @@ 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 3b16739a..c88df60a 100644 --- a/themes/hexo/components/CategoryGroup.js +++ b/themes/hexo/components/CategoryGroup.js @@ -9,17 +9,23 @@ 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 8ebfe2bd..11c231b9 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} - + className="pl-1 mr-2 cursor-pointer hover:underline"> + + {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 d4cbacab..9c2042e6 100644 --- a/themes/hexo/components/HexoRecentComments.js +++ b/themes/hexo/components/HexoRecentComments.js @@ -24,20 +24,22 @@ 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) =>
    - )} + {onLoading &&
    Loading...
    } + {!onLoading && comments && comments.length === 0 &&
    No Comments
    } + {!onLoading && comments && comments.length > 0 && comments.map((comment) =>
    +
    +
    --{comment.nick}
    +
    )} - + + ); } export default HexoRecentComments diff --git a/themes/hexo/components/LatestPostsGroup.js b/themes/hexo/components/LatestPostsGroup.js index 96eda369..a6741fc2 100644 --- a/themes/hexo/components/LatestPostsGroup.js +++ b/themes/hexo/components/LatestPostsGroup.js @@ -18,49 +18,47 @@ 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 2bfc6ea7..61408026 100644 --- a/themes/hexo/components/Logo.js +++ b/themes/hexo/components/Logo.js @@ -4,10 +4,12 @@ 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 5d455c0b..f6ae7a29 100644 --- a/themes/hexo/components/MenuButtonGroupTop.js +++ b/themes/hexo/components/MenuButtonGroupTop.js @@ -18,21 +18,30 @@ 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 57c8375b..1641023a 100644 --- a/themes/hexo/components/MenuGroupCard.js +++ b/themes/hexo/components/MenuGroupCard.js @@ -16,21 +16,30 @@ 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 bbab4a1b..e5579a6a 100644 --- a/themes/hexo/components/MenuList.js +++ b/themes/hexo/components/MenuList.js @@ -21,24 +21,32 @@ 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 f15b992d..d490cd7b 100644 --- a/themes/hexo/components/NavButtonGroup.js +++ b/themes/hexo/components/NavButtonGroup.js @@ -13,12 +13,21 @@ const NavButtonGroup = (props) => { return <> } - return + return ( + + ); } export default NavButtonGroup diff --git a/themes/hexo/components/PaginationNumber.js b/themes/hexo/components/PaginationNumber.js index fba781e2..0eb0b001 100644 --- a/themes/hexo/components/PaginationNumber.js +++ b/themes/hexo/components/PaginationNumber.js @@ -16,51 +16,57 @@ 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 aa3388ec..32221ea4 100644 --- a/themes/hexo/components/TagItemMini.js +++ b/themes/hexo/components/TagItemMini.js @@ -1,15 +1,21 @@ 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 fec458eb..6555a27f 100644 --- a/themes/hexo/components/TopNav.js +++ b/themes/hexo/components/TopNav.js @@ -90,10 +90,13 @@ const TopNav = props => {
    {locale.COMMON.CATEGORY}
    - - - {locale.COMMON.MORE} - + + + {locale.COMMON.MORE} +
    @@ -104,10 +107,13 @@ 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 d7c72799..7b57c3c0 100644 --- a/themes/matery/LayoutCategory.js +++ b/themes/matery/LayoutCategory.js @@ -7,30 +7,32 @@ 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 99c0f582..ab98d3a4 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 bed5cefc..db528a29 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}) -
    - - ) - })} -
    - - {/* 标签 */} - -
    - - {locale.COMMON.TAGS}: -
    -
    - {tags?.map(tag => { - return ( -
    - + + {category.name}({category.count})
    - ) - })} -
    -
    -
    - } + + ) + })} +
    + + {/* 标签 */} + +
    + + {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 a6a79e7b..6e95ff52 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 e3456747..e5b56411 100644 --- a/themes/matery/components/ArticleCopyright.js +++ b/themes/matery/components/ArticleCopyright.js @@ -16,24 +16,26 @@ 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 892e1c3e..1a4c9a4a 100644 --- a/themes/matery/components/ArticleInfo.js +++ b/themes/matery/components/ArticleInfo.js @@ -10,36 +10,38 @@ 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' && (<> - - - 发布日期: {date} - - - - 更新日期: {post.lastEditedTime} - - - - - - )} -
    +
    + {post?.type !== 'Page' && (<> + -
    + 发布日期:{date} + + + + 更新日期: {post.lastEditedTime} + + + + + + )} +
    + +
    + ); } diff --git a/themes/matery/components/ArticleRecommend.js b/themes/matery/components/ArticleRecommend.js index 428b7afa..ed87337e 100644 --- a/themes/matery/components/ArticleRecommend.js +++ b/themes/matery/components/ArticleRecommend.js @@ -34,35 +34,32 @@ 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 227a2697..20887d45 100644 --- a/themes/matery/components/BlogPostArchive.js +++ b/themes/matery/components/BlogPostArchive.js @@ -29,17 +29,20 @@ 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 fbe24de5..0f901a71 100644 --- a/themes/matery/components/BlogPostCard.js +++ b/themes/matery/components/BlogPostCard.js @@ -7,80 +7,83 @@ 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?.tagItems && post?.tagItems.length > 0 && (<> -
    -
    -
    -
    - {' '} - {post.tagItems.map(tag => ( - - ))} -
    -
    -
    - )} -
    -
    + + {post.date?.start_date || post.lastEditedTime} -
    - ) + + + + + {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 3104e338..f58aa9fb 100644 --- a/themes/matery/components/Catalog.js +++ b/themes/matery/components/Catalog.js @@ -58,12 +58,12 @@ const Catalog = ({ toc }) => { return <> } - return
    + return
    目录
    -
    +