下一篇
diff --git a/themes/heo/components/FloatTocButton.js b/themes/heo/components/FloatTocButton.js
new file mode 100644
index 00000000..bbded092
--- /dev/null
+++ b/themes/heo/components/FloatTocButton.js
@@ -0,0 +1,45 @@
+import { useState } from 'react'
+import Catalog from './Catalog'
+
+/**
+ * 移动端悬浮目录按钮
+ */
+export default function FloatTocButton(props) {
+ const [tocVisible, changeTocVisible] = useState(false)
+
+ const { post } = props
+
+ const toggleToc = () => {
+ changeTocVisible(!tocVisible)
+ }
+
+ // 没有目录就隐藏该按钮
+ if (!post || !post.toc || post.toc.length < 1) {
+ return <>>
+ }
+
+ return (
+ {/* 按钮 */}
+
+
+
+
+ {/* 目录Modal */}
+
+ {/* 侧边菜单 */}
+
+ {post && <>
+
+
+
+ >
+ }
+
+
+ {/* 背景蒙版 */}
+
+
)
+}
diff --git a/themes/heo/components/Hero.js b/themes/heo/components/Hero.js
index d34530c2..b6979531 100644
--- a/themes/heo/components/Hero.js
+++ b/themes/heo/components/Hero.js
@@ -180,7 +180,7 @@ function TopGroup(props) {
{/* eslint-disable-next-line */}

-
{p?.title}
+
{p?.title}
{/* hover 悬浮的 ‘荐’ 字 */}
荐
diff --git a/themes/heo/components/SlideOver.js b/themes/heo/components/SlideOver.js
index cc4a4772..fdd20bf4 100644
--- a/themes/heo/components/SlideOver.js
+++ b/themes/heo/components/SlideOver.js
@@ -1,5 +1,5 @@
-import { Fragment, useImperativeHandle, useState } from 'react'
+import { Fragment, useImperativeHandle, useRef, useState } from 'react'
import { Dialog, Transition } from '@headlessui/react'
import DarkModeButton from '@/components/DarkModeButton'
import Link from 'next/link'
@@ -13,8 +13,8 @@ export default function SlideOver(props) {
const [open, setOpen] = useState(false)
/**
- * 函数组件暴露方法useImperativeHandle
- */
+ * 函数组件暴露方法useImperativeHandle
+ */
useImperativeHandle(cRef, () => ({
toggleSlideOvers: toggleSlideOvers
}))
@@ -77,25 +77,22 @@ export default function SlideOver(props) {
功能
- 显示模式
+ {/* 切换深色模式 */}
+
博客
-
+ {/* 导航按钮 */}
-
- 主页
-
-
- 关于
-
+
+
@@ -109,3 +106,25 @@ export default function SlideOver(props) {
)
}
+
+/**
+ * 一个包含图标的按钮
+ */
+function DarkModeBlockButton() {
+ const darkModeRef = useRef()
+ function handleChangeDarkMode() {
+ darkModeRef?.current?.handleChangeDarkMode()
+ }
+ return
+}
+
+/**
+ * 一个简单的按钮
+ */
+function Button({ title, url }) {
+ return
+ {title}
+
+}
diff --git a/themes/heo/components/TocDrawer.js b/themes/heo/components/TocDrawer.js
deleted file mode 100644
index 13fad1a9..00000000
--- a/themes/heo/components/TocDrawer.js
+++ /dev/null
@@ -1,42 +0,0 @@
-import Catalog from './Catalog'
-import React, { useImperativeHandle, useState } from 'react'
-
-/**
- * 目录抽屉栏
- * @param toc
- * @param post
- * @returns {JSX.Element}
- * @constructor
- */
-const TocDrawer = ({ post, cRef }) => {
- // 暴露给父组件 通过cRef.current.handleMenuClick 调用
- useImperativeHandle(cRef, () => {
- return {
- handleSwitchVisible: () => switchVisible()
- }
- })
- const [showDrawer, switchShowDrawer] = useState(false)
- const switchVisible = () => {
- switchShowDrawer(!showDrawer)
- }
- return <>
-
- {/* 侧边菜单 */}
-
- {post && <>
-
-
-
- >
- }
-
-
- {/* 背景蒙版 */}
-
- >
-}
-export default TocDrawer
diff --git a/themes/heo/index.js b/themes/heo/index.js
index 68ef8a94..1a8f46e0 100644
--- a/themes/heo/index.js
+++ b/themes/heo/index.js
@@ -30,6 +30,7 @@ import { Style } from './style'
import { NoticeBar } from './components/NoticeBar'
import { HashTag } from '@/components/HeroIcons'
import LatestPostsGroup from './components/LatestPostsGroup'
+import FloatTocButton from './components/FloatTocButton'
/**
* 基础布局 采用上中下布局,移动端使用顶部侧边导航栏
@@ -56,7 +57,7 @@ const LayoutBase = props => {
{headerSlot}
{/* 主区块 */}
-
+
@@ -243,14 +244,14 @@ const LayoutSlug = props => {
return (
-
+
{lock &&
}
{!lock &&
{/* Notion文章主体 */}
-
+
@@ -277,6 +278,7 @@ const LayoutSlug = props => {
}
+
)