diff --git a/themes/matery/LayoutBase.js b/themes/matery/LayoutBase.js index f9e3e30b..bb4ea147 100644 --- a/themes/matery/LayoutBase.js +++ b/themes/matery/LayoutBase.js @@ -69,7 +69,7 @@ const LayoutBase = props => { -
+
diff --git a/themes/matery/LayoutSlug.js b/themes/matery/LayoutSlug.js index c0fbc63c..85ef4ced 100644 --- a/themes/matery/LayoutSlug.js +++ b/themes/matery/LayoutSlug.js @@ -1,21 +1,17 @@ import React from 'react' import { ArticleLock } from './components/ArticleLock' import HeaderArticle from './components/HeaderArticle' -import JumpToCommentButton from './components/JumpToCommentButton' -import TocDrawer from './components/TocDrawer' -import TocDrawerButton from './components/TocDrawerButton' import LayoutBase from './LayoutBase' import Comment from '@/components/Comment' import NotionPage from '@/components/NotionPage' import ArticleAdjacent from './components/ArticleAdjacent' import ArticleCopyright from './components/ArticleCopyright' -import { isBrowser } from '@/lib/utils' import { ArticleInfo } from './components/ArticleInfo' import Catalog from './components/Catalog' +import JumpToCommentButton from './components/JumpToCommentButton' export const LayoutSlug = props => { const { post, lock, validPassword } = props - const drawerRight = React.useRef(null) const [show, switchShow] = React.useState(false) @@ -41,26 +37,12 @@ export const LayoutSlug = props => { > } - const targetRef = isBrowser() ? document.getElementById('container') : null - - const floatSlot = <> - {post?.toc?.length > 1 &&
- { - drawerRight?.current?.handleSwitchVisible() - }} - /> -
} - - - return ( } {...props} showCategory={false} showTag={false} - floatSlot={floatSlot} >
@@ -111,6 +93,10 @@ export const LayoutSlug = props => { {post.type === 'Post' && }
+
+ +
+
{show && } @@ -118,10 +104,6 @@ export const LayoutSlug = props => {
-
- -
-
) } diff --git a/themes/matery/components/JumpToCommentButton.js b/themes/matery/components/JumpToCommentButton.js index 783b328c..1a11e765 100644 --- a/themes/matery/components/JumpToCommentButton.js +++ b/themes/matery/components/JumpToCommentButton.js @@ -15,15 +15,13 @@ const JumpToCommentButton = () => { if (document.getElementById('comment')) { window.scrollTo({ top: document.getElementById('comment').offsetTop, behavior: 'smooth' }) } - // 兼容性不好 - // const commentElement = document.getElementById('comment') - // if (commentElement) { - // commentElement?.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' }) } - return (
- -
) + return (
+ +
) } export default JumpToCommentButton