diff --git a/components/Container.js b/components/Container.js index 4e408b6f..4aba5db5 100644 --- a/components/Container.js +++ b/components/Container.js @@ -1,7 +1,6 @@ import PropTypes from 'prop-types' import React, { useCallback, useEffect } from 'react' import CommonHead from '@/components/CommonHead' -import TopNav from '@/components/TopNav' import throttle from 'lodash.throttle' import BLOG from '@/blog.config' import { useTheme } from '@/lib/theme' @@ -15,14 +14,14 @@ const Container = ({ children, layout, fullWidth, tags, meta, ...customMeta }) = const tagsBar = document.querySelector('#tags-bar') const rightToc = document.querySelector('#right-toc') if (scrollS >= windowTop && scrollS > 10) { - nav && nav.classList.add('-mt-16') - tagsBar && tagsBar.classList.add('-mt-32') + nav && nav.classList.replace('top-0', '-top-16') + tagsBar && tagsBar.classList.replace('top-16', 'top-0') sidebar && sidebar.classList.replace('top-20', 'top-2') rightToc && rightToc.classList.replace('top-16', 'top-0') windowTop = scrollS } else { - nav && nav.classList.remove('-mt-16') - tagsBar && tagsBar.classList.remove('-mt-32') + nav && nav.classList.replace('-top-16', 'top-0') + tagsBar && tagsBar.classList.replace('top-0', 'top-16') sidebar && sidebar.classList.replace('top-2', 'top-20') rightToc && rightToc.classList.replace('top-0', 'top-16') windowTop = scrollS diff --git a/components/JumpToTop.js b/components/JumpToTop.js index cf6d65ae..4acc8b6d 100644 --- a/components/JumpToTop.js +++ b/components/JumpToTop.js @@ -37,15 +37,17 @@ const JumpToTop = ({ targetRef, showPercent = true }) => { className={(show ? 'animate__fade InUp' : 'animate__fadeOutUp') + ' rounded-full animate__animated animate__faster shadow-xl'}>
window.scrollTo({ top: 0, behavior: 'smooth' })}> {showPercent && (
- {percent}% + {percent}%
)} - +
+ +
diff --git a/components/TagsBar.js b/components/TagsBar.js index 0365aefa..901a06f2 100644 --- a/components/TagsBar.js +++ b/components/TagsBar.js @@ -10,7 +10,7 @@ import Link from 'next/link' const TagsBar = ({ tags, currentTag }) => { if (!tags) return <> return ( -
+
diff --git a/components/TopNav.js b/components/TopNav.js index 62735b74..5b7b5f92 100644 --- a/components/TopNav.js +++ b/components/TopNav.js @@ -10,13 +10,13 @@ const TopNav = ({ tags, currentTag, post }) => { const drawer = useRef() const drawerRight = useRef() - return (
+ return (<> {/* 侧面抽屉 */} {/* 导航栏 */} -