+
{slotTop}
{onLoading ? LoadingCover : children}
@@ -80,17 +80,15 @@ const LayoutBase = props => {
- {/* 左侧推拉抽屉 */}
-
+ {/* 右侧侧推拉抽屉 */}
+
-
- {slotLeft}
-
- {router.pathname !== '/search' && }
- {showInfoCard && }
- {CONFIG_MEDIUM.WIDGET_REVOLVER_MAPS === 'true' && }
-
-
+ {slotRight}
+
+
+
+ {CONFIG_MEDIUM.WIDGET_REVOLVER_MAPS === 'true' && }
+
diff --git a/themes/gitbook/LayoutIndex.js b/themes/gitbook/LayoutIndex.js
index 41410467..6071f9fc 100644
--- a/themes/gitbook/LayoutIndex.js
+++ b/themes/gitbook/LayoutIndex.js
@@ -1,11 +1,11 @@
-import BLOG from '@/blog.config'
-import BlogPostListPage from './components/BlogPostListPage'
-import BlogPostListScroll from './components/BlogPostListScroll'
import LayoutBase from './LayoutBase'
+import Announcement from './components/Announcement'
+import ArticleInfo from './components/ArticleInfo'
export const LayoutIndex = (props) => {
return
- {BLOG.POST_LIST_STYLE === 'page' ? : }
+ {/* gitbook主题首页只显示公告 */}
+
}
diff --git a/themes/gitbook/LayoutSlug.js b/themes/gitbook/LayoutSlug.js
index 68308ab7..78b0f5b2 100644
--- a/themes/gitbook/LayoutSlug.js
+++ b/themes/gitbook/LayoutSlug.js
@@ -15,7 +15,7 @@ import CategoryItem from './components/CategoryItem'
import TagItemMini from './components/TagItemMini'
import ShareBar from '@/components/ShareBar'
-export const LayoutSlug = props => {
+export const LayoutSlug = (props) => {
const { post, prev, next, siteInfo, lock, validPassword } = props
const { locale } = useGlobal()
@@ -23,20 +23,15 @@ export const LayoutSlug = props => {
post?.date?.start_date || post?.createdTime,
locale.LOCALE
)
+
+ const slotRight = post?.toc && post?.toc?.length > 3 &&
+ console.log(slotRight, post, 'jhhh')
+
if (!post) {
- return
+ return
}
-
- const slotLeft = post?.toc && post?.toc?.length > 3 && (
-
-
- {/* */}
-
- )
-
return (
-
+
{/* 文章锁 */}
{lock && }
diff --git a/themes/gitbook/components/Announcement.js b/themes/gitbook/components/Announcement.js
new file mode 100755
index 00000000..62df1ec2
--- /dev/null
+++ b/themes/gitbook/components/Announcement.js
@@ -0,0 +1,21 @@
+// import { useGlobal } from '@/lib/global'
+import dynamic from 'next/dynamic'
+
+const NotionPage = dynamic(() => import('@/components/NotionPage'))
+
+const Announcement = ({ notice, className }) => {
+// const { locale } = useGlobal()
+ if (notice?.blockMap) {
+ return
+
+ {/* {locale.COMMON.ANNOUNCEMENT}
*/}
+ {notice && (
+
+
)}
+
+
+ } else {
+ return <>>
+ }
+}
+export default Announcement
diff --git a/themes/gitbook/components/ArticleInfo.js b/themes/gitbook/components/ArticleInfo.js
new file mode 100644
index 00000000..b2d58efe
--- /dev/null
+++ b/themes/gitbook/components/ArticleInfo.js
@@ -0,0 +1,9 @@
+export default function ArticleInfo({ post }) {
+ if (!post) {
+ return null
+ }
+ return
+
+ Last update: { post.date?.start_date}
+
+}
diff --git a/themes/gitbook/components/BlogPostCard.js b/themes/gitbook/components/BlogPostCard.js
index 998dd086..fd277508 100644
--- a/themes/gitbook/components/BlogPostCard.js
+++ b/themes/gitbook/components/BlogPostCard.js
@@ -1,80 +1,27 @@
import BLOG from '@/blog.config'
-import NotionPage from '@/components/NotionPage'
-import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import React from 'react'
-import CONFIG_MEDIUM from '../config_medium'
-import CategoryItem from './CategoryItem'
-import TagItemMini from './TagItemMini'
-import TwikooCommentCount from '@/components/TwikooCommentCount'
const BlogPostCard = ({ post, showSummary }) => {
- const showPreview = CONFIG_MEDIUM.POST_LIST_PREVIEW && post.blockMap
- const { locale } = useGlobal()
return (
-
+
- {CONFIG_MEDIUM.POST_LIST_COVER &&
- {/* eslint-disable-next-line @next/next/no-img-element */}
-

-
}
- {post.title}
+ {post.category} - {post.title}
-
-
{post.date?.start_date}
- {CONFIG_MEDIUM.POST_LIST_CATEGORY &&
}
- {CONFIG_MEDIUM.POST_LIST_TAG && post?.tagItems?.map(tag =>
)}
-
-
-
-
-
- {(!showPreview || showSummary) && (
-
- {post.summary}
-
- )}
-
- {showPreview && (
-
-
-
-
-
-
- {locale.COMMON.ARTICLE_DETAIL}
-
-
-
-
-
-
- )}
)
diff --git a/themes/gitbook/components/BlogPostListScroll.js b/themes/gitbook/components/BlogPostListScroll.js
index 2c7eafbd..2212d51e 100644
--- a/themes/gitbook/components/BlogPostListScroll.js
+++ b/themes/gitbook/components/BlogPostListScroll.js
@@ -1,7 +1,6 @@
import BLOG from '@/blog.config'
import BlogPostCard from './BlogPostCard'
import BlogPostListEmpty from './BlogPostListEmpty'
-import { useGlobal } from '@/lib/global'
import throttle from 'lodash.throttle'
import React, { useCallback, useEffect, useRef, useState } from 'react'
import { useRouter } from 'next/router'
@@ -17,7 +16,8 @@ const BlogPostListScroll = ({ posts = [], currentSearch }) => {
const postsPerPage = BLOG.POSTS_PER_PAGE
const [page, updatePage] = useState(1)
let filteredPosts = Object.assign(posts)
- const searchKey = getSearchKey()
+ const router = useRouter()
+ const searchKey = getSearchKey(router)
if (searchKey) {
filteredPosts = posts.filter(post => {
const tagContent = post.tags ? post.tags.join(' ') : ''
@@ -56,7 +56,6 @@ const BlogPostListScroll = ({ posts = [], currentSearch }) => {
})
const targetRef = useRef(null)
- const { locale } = useGlobal()
if (!postsToShow || postsToShow.length === 0) {
return
@@ -70,13 +69,6 @@ const BlogPostListScroll = ({ posts = [], currentSearch }) => {
))}
-
-
{
- handleGetMore()
- }}
- className='w-full my-4 py-4 text-center cursor-pointer dark:text-gray-200'
- > {hasMore ? locale.COMMON.MORE : `${locale.COMMON.NO_MORE} 😰`}
-
}
}
@@ -95,8 +87,7 @@ const getPostByPage = function (page, totalPosts, postsPerPage) {
)
}
-function getSearchKey() {
- const router = useRouter()
+function getSearchKey(router) {
if (router.query && router.query.s) {
return router.query.s
}
diff --git a/themes/gitbook/components/Footer.js b/themes/gitbook/components/Footer.js
index b9d4f49c..cde8885e 100644
--- a/themes/gitbook/components/Footer.js
+++ b/themes/gitbook/components/Footer.js
@@ -14,7 +14,7 @@ const Footer = ({ title }) => {
return (