+ {slotRight}
+
{showInfoCard && }
{CONFIG_MEDIUM.WIDGET_REVOLVER_MAPS === 'true' && }
@@ -60,8 +51,8 @@ const LayoutBase = props => {
{/* 移动端底部 */}
-
-
+
+
)
}
diff --git a/themes/Medium/LayoutSlug.js b/themes/Medium/LayoutSlug.js
index 14419392..015e6d29 100644
--- a/themes/Medium/LayoutSlug.js
+++ b/themes/Medium/LayoutSlug.js
@@ -14,7 +14,7 @@ import { useGlobal } from '@/lib/global'
import formatDate from '@/lib/formatDate'
import Link from 'next/link'
import mediumZoom from 'medium-zoom'
-import { useEffect, useRef } from 'react'
+import React, { useEffect, useRef } from 'react'
import ArticleAround from './components/ArticleAround'
import Catalog from './components/Catalog'
@@ -56,7 +56,9 @@ export const LayoutSlug = (props) => {
}
})
- return
}>
+ const slotRight = post?.toc &&
+
+ return
{post?.title}
diff --git a/themes/Medium/components/BlogPostCard.js b/themes/Medium/components/BlogPostCard.js
index a9e1ee5c..76ab1933 100644
--- a/themes/Medium/components/BlogPostCard.js
+++ b/themes/Medium/components/BlogPostCard.js
@@ -15,7 +15,7 @@ const BlogPostCard = ({ post, showSummary }) => {
-
+
{post.title}
diff --git a/themes/Medium/components/BottomMenuBar.js b/themes/Medium/components/BottomMenuBar.js
index 75c2a9e0..6e8e0c71 100644
--- a/themes/Medium/components/BottomMenuBar.js
+++ b/themes/Medium/components/BottomMenuBar.js
@@ -2,6 +2,7 @@ import { faHome, faSearch } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import Link from 'next/link'
import React from 'react'
+import JumpToTopButton from '@/themes/Medium/components/JumpToTopButton'
export default function BottomMenuBar ({ className }) {
return (
@@ -17,6 +18,9 @@ export default function BottomMenuBar ({ className }) {
+
+
+
)
diff --git a/themes/Medium/components/Catalog.js b/themes/Medium/components/Catalog.js
index d82bee28..9ae655a1 100644
--- a/themes/Medium/components/Catalog.js
+++ b/themes/Medium/components/Catalog.js
@@ -2,8 +2,6 @@ import React from 'react'
import throttle from 'lodash.throttle'
import { uuidToId } from 'notion-utils'
import Progress from './Progress'
-import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
-import { faStream } from '@fortawesome/free-solid-svg-icons'
// import { cs } from 'react-notion-x'
/**
@@ -55,7 +53,6 @@ const Catalog = ({ toc }) => {
}, throttleMs))
return
-
目录
diff --git a/themes/Medium/components/JumpToTopButton.js b/themes/Medium/components/JumpToTopButton.js
new file mode 100644
index 00000000..7126309c
--- /dev/null
+++ b/themes/Medium/components/JumpToTopButton.js
@@ -0,0 +1,28 @@
+import { useGlobal } from '@/lib/global'
+import { faArrowUp } from '@fortawesome/free-solid-svg-icons'
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
+import React from 'react'
+import CONFIG_MEDIUM from '../config_medium'
+
+/**
+ * 跳转到网页顶部
+ * 当屏幕下滑500像素后会出现该控件
+ * @param targetRef 关联高度的目标html标签
+ * @param showPercent 是否显示百分比
+ * @returns {JSX.Element}
+ * @constructor
+ */
+const JumpToTopButton = ({ showPercent = false, percent }) => {
+ if (!CONFIG_MEDIUM.WIDGET_TO_TOP) {
+ return <>>
+ }
+ const { locale } = useGlobal()
+ return (
window.scrollTo({ top: 0, behavior: 'smooth' })} >
+
+
+
+ {showPercent && (
{percent}%
)}
+
)
+}
+
+export default JumpToTopButton
diff --git a/themes/Medium/components/LeftMenuBar.js b/themes/Medium/components/LeftMenuBar.js
new file mode 100644
index 00000000..680855c2
--- /dev/null
+++ b/themes/Medium/components/LeftMenuBar.js
@@ -0,0 +1,16 @@
+import Link from 'next/link'
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
+import { faHome } from '@fortawesome/free-solid-svg-icons'
+import React from 'react'
+
+export default function LeftMenuBar () {
+ return
+}
diff --git a/themes/Medium/components/TopNavBar.js b/themes/Medium/components/TopNavBar.js
index c73223c3..b08dc88b 100644
--- a/themes/Medium/components/TopNavBar.js
+++ b/themes/Medium/components/TopNavBar.js
@@ -1,7 +1,7 @@
import LogoBar from '@/themes/Medium/components/LogoBar'
export default function TopNavBar ({ className }) {
- return
+ return
diff --git a/themes/Medium/config_medium.js b/themes/Medium/config_medium.js
index 4d13d756..e61b1982 100644
--- a/themes/Medium/config_medium.js
+++ b/themes/Medium/config_medium.js
@@ -11,6 +11,7 @@ const CONFIG_MEDIUM = {
MENU_SEARCH: true, // 显示搜索
// Widget
- WIDGET_REVOLVER_MAPS: process.env.NEXT_PUBLIC_WIDGET_REVOLVER_MAPS || 'false' // 地图插件
+ WIDGET_REVOLVER_MAPS: process.env.NEXT_PUBLIC_WIDGET_REVOLVER_MAPS || 'false', // 地图插件
+ WIDGET_TO_TOP: true // 跳回顶部
}
export default CONFIG_MEDIUM