From 87803a694b1b40179072a77a499bec43f1e795e9 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Tue, 30 Apr 2024 14:12:00 +0800 Subject: [PATCH] =?UTF-8?q?gitbook=E4=B8=BB=E9=A2=98=E6=B7=B1=E8=89=B2?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/gitbook/components/BlogPostCard.js | 37 +++++++++++++-------- themes/gitbook/components/NavPostItem.js | 2 +- themes/gitbook/components/PageNavDrawer.js | 38 +++++++++++++--------- 3 files changed, 48 insertions(+), 29 deletions(-) diff --git a/themes/gitbook/components/BlogPostCard.js b/themes/gitbook/components/BlogPostCard.js index 352d0988..8ce99f09 100644 --- a/themes/gitbook/components/BlogPostCard.js +++ b/themes/gitbook/components/BlogPostCard.js @@ -1,25 +1,36 @@ +import Badge from '@/components/Badge' +import NotionIcon from '@/components/NotionIcon' import { siteConfig } from '@/lib/config' +import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' import Link from 'next/link' import { useRouter } from 'next/router' -import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' -import NotionIcon from '@/components/NotionIcon' -import Badge from '@/components/Badge' import CONFIG from '../config' const BlogPostCard = ({ post, className }) => { const router = useRouter() const currentSelected = router.asPath.split('?')[0] === '/' + post.slug - const url = checkContainHttp(post.slug) ? sliceUrlFromHttp(post.slug) : `${siteConfig('SUB_PATH', '')}/${post.slug}` + const url = checkContainHttp(post.slug) + ? sliceUrlFromHttp(post.slug) + : `${siteConfig('SUB_PATH', '')}/${post.slug}` return ( - -
-
- {siteConfig('POST_TITLE_ICON') && } {post.title} -
- {/* 最新文章加个红点 */} - {post?.isLatest && siteConfig('GITBOOK_LATEST_POST_RED_BADGE', false, CONFIG) && } -
- + +
+
+ {siteConfig('POST_TITLE_ICON') && ( + + )}{' '} + {post.title} +
+ {/* 最新文章加个红点 */} + {post?.isLatest && + siteConfig('GITBOOK_LATEST_POST_RED_BADGE', false, CONFIG) && ( + + )} +
+ ) } diff --git a/themes/gitbook/components/NavPostItem.js b/themes/gitbook/components/NavPostItem.js index 409531a8..cd0c1742 100644 --- a/themes/gitbook/components/NavPostItem.js +++ b/themes/gitbook/components/NavPostItem.js @@ -28,7 +28,7 @@ const NavPostItem = props => { <>
{group?.category}
diff --git a/themes/gitbook/components/PageNavDrawer.js b/themes/gitbook/components/PageNavDrawer.js index 14846699..b5657d18 100644 --- a/themes/gitbook/components/PageNavDrawer.js +++ b/themes/gitbook/components/PageNavDrawer.js @@ -8,7 +8,7 @@ import NavPostList from './NavPostList' * @returns {JSX.Element} * @constructor */ -const PageNavDrawer = (props) => { +const PageNavDrawer = props => { const { pageNavVisible, changePageNavVisible } = useGitBookGlobal() const { filteredNavPages } = props @@ -16,21 +16,29 @@ const PageNavDrawer = (props) => { changePageNavVisible(!pageNavVisible) } - return <> -
- {/* 侧边菜单 */} -
-
- {/* 所有文章列表 */} - -
-
+ return ( + <> +
+ {/* 侧边菜单 */} +
+ {/* 所有文章列表 */} +
+ +
- {/* 背景蒙版 */} -
+
+ + {/* 背景蒙版 */} +
+ ) } export default PageNavDrawer