From f60af40459207ecd6f9a93bdb1a7ac3d5ae0334b Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Tue, 1 Aug 2023 14:23:44 +0800 Subject: [PATCH] =?UTF-8?q?gitbook=20=E5=BD=92=E6=A1=A3=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/gitbook/components/BlogArchiveItem.js | 36 +++++++++++ themes/gitbook/index.js | 64 ++++++++++++++++++-- 2 files changed, 95 insertions(+), 5 deletions(-) create mode 100644 themes/gitbook/components/BlogArchiveItem.js diff --git a/themes/gitbook/components/BlogArchiveItem.js b/themes/gitbook/components/BlogArchiveItem.js new file mode 100644 index 00000000..8e9693dc --- /dev/null +++ b/themes/gitbook/components/BlogArchiveItem.js @@ -0,0 +1,36 @@ +import BLOG from '@/blog.config' +import Link from 'next/link' + +/** + * 归档分组 + * @param {*} param0 + * @returns + */ +export default function BlogArchiveItem({ archiveTitle, archivePosts }) { + return ( +
+
+ {archiveTitle} +
+ +
+ ) +} diff --git a/themes/gitbook/index.js b/themes/gitbook/index.js index e5fcaeac..72056e66 100644 --- a/themes/gitbook/index.js +++ b/themes/gitbook/index.js @@ -31,6 +31,9 @@ import { ArticleLock } from './components/ArticleLock' import { Transition } from '@headlessui/react' import { Style } from './style' import CommonHead from '@/components/CommonHead' +import BlogArchiveItem from './components/BlogArchiveItem' +import BlogPostListPage from './components/BlogPostListPage' +import Link from 'next/link' // 主题全局变量 const ThemeGlobalGitbook = createContext() @@ -194,7 +197,9 @@ const LayoutIndex = (props) => { * @returns */ const LayoutPostList = (props) => { - return + return +
+
} /** @@ -253,13 +258,19 @@ const LayoutSearch = (props) => { } /** - * 没有归档 + * 归档页面基本不会用到 * 全靠页面导航 * @param {*} props * @returns */ const LayoutArchive = (props) => { - return + const { archivePosts } = props + + return +
+ {Object.keys(archivePosts)?.map(archiveTitle => )} +
+
} /** @@ -275,14 +286,57 @@ const Layout404 = props => { * 分类列表 */ const LayoutCategoryIndex = (props) => { - return + const { categoryOptions } = props + const { locale } = useGlobal() + return +
+
+ {locale.COMMON.CATEGORY}: +
+
+ {categoryOptions?.map(category => { + return ( + +
+ {category.name}({category.count}) +
+ + ) + })} +
+
+
} /** * 标签列表 */ const LayoutTagIndex = (props) => { - return + const { tagOptions } = props + const { locale } = useGlobal() + + return +
+
+ + {locale.COMMON.TAGS}: +
+
+ {tagOptions?.map(tag => { + return ( +
+ +
+ ) + })} +
+
+
} export {