diff --git a/themes/gitbook/components/BottomMenuBar.js b/themes/gitbook/components/BottomMenuBar.js index 478a52eb..c872941b 100644 --- a/themes/gitbook/components/BottomMenuBar.js +++ b/themes/gitbook/components/BottomMenuBar.js @@ -1,5 +1,5 @@ -import MobileButtonCatalog from './MobileButtonCatalog' -import MobileButtonPageNav from './MobileButtonPageNav' +import { useGlobal } from '@/lib/global' +import { useGitBookGlobal } from '..' /** * 移动端底部导航 @@ -8,20 +8,43 @@ import MobileButtonPageNav from './MobileButtonPageNav' */ export default function BottomMenuBar({ post, className }) { const showTocButton = post?.toc?.length > 1 + const { locale } = useGlobal() + const { pageNavVisible, changePageNavVisible, tocVisible, changeTocVisible } = + useGitBookGlobal() + const togglePageNavVisible = () => { + changePageNavVisible(!pageNavVisible) + } + + const toggleToc = () => { + changeTocVisible(!tocVisible) + } return ( - <> - {/* 移动端底部导航按钮 */} -
-
- -
+
+
+ + {showTocButton && ( -
- -
+ )}
- +
) } diff --git a/themes/gitbook/components/MobileButtonCatalog.js b/themes/gitbook/components/MobileButtonCatalog.js deleted file mode 100644 index e9e8b4e0..00000000 --- a/themes/gitbook/components/MobileButtonCatalog.js +++ /dev/null @@ -1,31 +0,0 @@ -import { useGlobal } from '@/lib/global' -import { useGitBookGlobal } from '@/themes/gitbook' - -/** - * 移动端目录按钮 - */ -export default function MobileButtonCatalog() { - const { tocVisible, changeTocVisible } = useGitBookGlobal() - const { locale } = useGlobal() - - const toggleToc = () => { - changeTocVisible(!tocVisible) - } - - return ( -
- - - {locale.COMMON.TABLE_OF_CONTENTS} - -
- ) -} diff --git a/themes/gitbook/components/MobileButtonPageNav.js b/themes/gitbook/components/MobileButtonPageNav.js deleted file mode 100644 index 78f038f1..00000000 --- a/themes/gitbook/components/MobileButtonPageNav.js +++ /dev/null @@ -1,30 +0,0 @@ -import { useGlobal } from '@/lib/global' -import { useGitBookGlobal } from '@/themes/gitbook' - -/** - * 移动端文章导航按钮 - */ -export default function MobileButtonPageNav() { - const { pageNavVisible, changePageNavVisible } = useGitBookGlobal() - const { locale } = useGlobal() - const togglePageNavVisible = () => { - changePageNavVisible(!pageNavVisible) - } - - return ( -
- - - {locale.COMMON.ARTICLE_LIST} - -
- ) -}