diff --git a/themes/gitbook/LayoutBase.js b/themes/gitbook/LayoutBase.js deleted file mode 100644 index 071a68a0..00000000 --- a/themes/gitbook/LayoutBase.js +++ /dev/null @@ -1,138 +0,0 @@ -import CommonHead from '@/components/CommonHead' -import { useState, createContext, useContext, useEffect } from 'react' -import Footer from './components/Footer' -import InfoCard from './components/InfoCard' -import RevolverMaps from './components/RevolverMaps' -import CONFIG_GITBOOK from './config_gitbook' -import TopNavBar from './components/TopNavBar' -import SearchInput from './components/SearchInput' -import { useGlobal } from '@/lib/global' -import Live2D from '@/components/Live2D' -import BLOG from '@/blog.config' -import NavPostList from './components/NavPostList' -import ArticleInfo from './components/ArticleInfo' -import Catalog from './components/Catalog' -import { useRouter } from 'next/router' -import Announcement from './components/Announcement' -import PageNavDrawer from './components/PageNavDrawer' -import FloatTocButton from './components/FloatTocButton' -import { AdSlot } from '@/components/GoogleAdsense' -import JumpToTopButton from './components/JumpToTopButton' -const ThemeGlobalMedium = createContext() - -/** - * 基础布局 采用左右两侧布局,移动端使用顶部导航栏 - - * @returns {JSX.Element} - * @constructor - */ -const LayoutBase = (props) => { - const { children, meta, post, allNavPages, slotLeft, slotRight, slotTop } = props - const [tocVisible, changeTocVisible] = useState(false) - const [pageNavVisible, changePageNavVisible] = useState(false) - const [filterPosts, setFilterPosts] = useState(allNavPages) - const { onLoading } = useGlobal() - const router = useRouter() - - const showTocButton = post?.toc?.length > 1 - - useEffect(() => { - setFilterPosts(allNavPages) - }, [post]) - - const LoadingCover =
-
- -
-
- - return ( - - - -
- {/* 顶部导航栏 */} - - -
- - {/* 左侧推拉抽屉 */} - - -
- -
- {slotTop} - - - - {onLoading ? LoadingCover : children} - - - - {/* 回顶按钮 */} - -
- - {/* 底部 */} -
-
-
-
- -
-
- - {/* 右侧侧推拉抽屉 */} -
-
- - -
- - {slotRight} - {router.route === '/' && <> - - {CONFIG_GITBOOK.WIDGET_REVOLVER_MAPS === 'true' && } - - } - {/* gitbook主题首页只显示公告 */} - -
- - - -
-
- -
- - {showTocButton && !tocVisible &&
- -
} - - - - {/* 移动端底部导航栏 */} - {/* */} -
-
- ) -} - -export default LayoutBase -export const useGitBookGlobal = () => useContext(ThemeGlobalMedium) diff --git a/themes/gitbook/index.js b/themes/gitbook/index.js index 9a8b166b..176a063e 100644 --- a/themes/gitbook/index.js +++ b/themes/gitbook/index.js @@ -3,7 +3,6 @@ import { useRouter } from 'next/router' import { useEffect, useState, createContext, useContext } from 'react' import { isBrowser } from '@/lib/utils' import CommonHead from '@/components/CommonHead' - import Footer from './components/Footer' import InfoCard from './components/InfoCard' import RevolverMaps from './components/RevolverMaps' @@ -41,7 +40,7 @@ export const useGitBookGlobal = () => useContext(ThemeGlobalGitbook) * @constructor */ const LayoutBase = (props) => { - const { children, meta, post, allNavPages, slotLeft, slotRight, slotTop, siteInfo } = props + const { children, meta, post, allNavPages, slotLeft, slotRight, slotTop } = props const { onLoading } = useGlobal() const router = useRouter() const [tocVisible, changeTocVisible] = useState(false) @@ -71,8 +70,10 @@ const LayoutBase = (props) => { {/* 所有文章列表 */} - - + +
+
+
@@ -87,7 +88,9 @@ const LayoutBase = (props) => {
{/* 底部 */} -