diff --git a/blog.config.js b/blog.config.js index 2103e7c4..d35bb178 100644 --- a/blog.config.js +++ b/blog.config.js @@ -56,13 +56,13 @@ const BLOG = { telegram: 'https://t.me/tangly_1024' }, comment: { // 评论插件,支持 gitalk, utterances, cusdis - provider: '', // 不需要则留空白 + provider: 'gitalk', // 不需要则留空白 gitalkConfig: { repo: 'NotionNext', // The repository of store comments owner: 'tangly1024', admin: ['tangly1024'], - clientID: 'be7864a16b693e256f8f', - clientSecret: 'dbd0f6d9ceea8940f6ed20936b415274b8fe66a2', + clientID: process.env.GITALK_ID || 'be7864a16b693e256f8f', + clientSecret: process.env.GITALK_SECRET || 'dbd0f6d9ceea8940f6ed20936b415274b8fe66a2', distractionFreeMode: false }, cusdisConfig: { diff --git a/components/ArticleDetail.js b/components/ArticleDetail.js index 458e9445..e099dc48 100644 --- a/components/ArticleDetail.js +++ b/components/ArticleDetail.js @@ -172,7 +172,7 @@ export default function ArticleDetail ({ post, recommendPosts, prev, next }) { {/* 评论互动 */} -
+
) diff --git a/components/Comment.js b/components/Comment.js index ea747509..5e49f4d3 100644 --- a/components/Comment.js +++ b/components/Comment.js @@ -2,6 +2,7 @@ import BLOG from '@/blog.config' import dynamic from 'next/dynamic' import { useRouter } from 'next/router' import { useGlobal } from '@/lib/global' +import 'gitalk/dist/gitalk.css' const GitalkComponent = dynamic( () => { diff --git a/components/FloatDarkModeButton.js b/components/FloatDarkModeButton.js index bf01f26b..6a286fcd 100644 --- a/components/FloatDarkModeButton.js +++ b/components/FloatDarkModeButton.js @@ -24,7 +24,7 @@ export default function FloatDarkModeButton () { return (
{ return () => document.removeEventListener('scroll', scrollListener) }, [show]) - return (
+ return (
- {showPercent && (
{percent}%
)} + {showPercent && (
{percent}%
)}
) } diff --git a/components/JumpToTopButton.js b/components/JumpToTopButton.js index f72ee0fa..9fb58f9e 100644 --- a/components/JumpToTopButton.js +++ b/components/JumpToTopButton.js @@ -17,7 +17,7 @@ const JumpToTopButton = ({ showPercent = true, percent }) => { return <> } const { locale } = useGlobal() - return (
window.scrollTo({ top: 0, behavior: 'smooth' })} > + return (
window.scrollTo({ top: 0, behavior: 'smooth' })} >
diff --git a/components/Progress.js b/components/Progress.js index a46ae098..4c4adb9f 100644 --- a/components/Progress.js +++ b/components/Progress.js @@ -9,11 +9,12 @@ const Progress = ({ targetRef, showPercent = true }) => { const currentRef = targetRef?.current || targetRef const [percent, changePercent] = useState(0) const scrollListener = () => { - if (currentRef) { - const clientHeight = currentRef ? (currentRef.clientHeight) : 0 + const target = currentRef || document.getElementById('container') + if (target) { + const clientHeight = target.clientHeight const scrollY = window.pageYOffset const fullHeight = clientHeight - window.outerHeight - let per = parseFloat(((scrollY / fullHeight * 100)).toFixed(0)) + let per = parseFloat(((scrollY / fullHeight) * 100).toFixed(0)) if (per > 100) per = 100 if (per < 0) per = 0 changePercent(per) @@ -25,11 +26,18 @@ const Progress = ({ targetRef, showPercent = true }) => { return () => document.removeEventListener('scroll', scrollListener) }, [percent]) - return (
-
- {showPercent &&
{percent}%
} + return ( +
+
+ {showPercent && ( +
{percent}%
+ )}
-
) +
+ ) } export default Progress diff --git a/components/SideAreaLeft.js b/components/SideAreaLeft.js index 77d6c66f..51c1bb81 100644 --- a/components/SideAreaLeft.js +++ b/components/SideAreaLeft.js @@ -44,7 +44,7 @@ const SideAreaLeft = ({ title, tags, currentTag, post, postCount, categories, cu {showToc && (
- +
)} diff --git a/components/Toc.js b/components/Toc.js index 4bd1aa21..676dbbd2 100644 --- a/components/Toc.js +++ b/components/Toc.js @@ -10,7 +10,7 @@ import Progress from './Progress' * @returns {JSX.Element} * @constructor */ -const Toc = ({ toc, targetRef }) => { +const Toc = ({ toc }) => { // 无目录就直接返回空 if (!toc || toc.length < 1) { return <> @@ -54,7 +54,7 @@ const Toc = ({ toc, targetRef }) => { return <>
- +
- +
} diff --git a/components/TocDrawerButton.js b/components/TocDrawerButton.js index e828290e..06dc454b 100644 --- a/components/TocDrawerButton.js +++ b/components/TocDrawerButton.js @@ -16,7 +16,7 @@ const TocDrawerButton = (props) => { return <> } const { locale } = useGlobal() - return (
+ return (
) } diff --git a/layouts/BaseLayout.js b/layouts/BaseLayout.js index 7418b0c4..a516fced 100644 --- a/layouts/BaseLayout.js +++ b/layouts/BaseLayout.js @@ -96,15 +96,16 @@ const BaseLayout = ({ -
-
- - - - {floatSlot} + {/* 右下角悬浮 */} +
+
+ + + + {floatSlot} +
-