diff --git a/components/FloatDarkModeButton.js b/components/FloatDarkModeButton.js index 6d4632a4..a22abdf2 100644 --- a/components/FloatDarkModeButton.js +++ b/components/FloatDarkModeButton.js @@ -3,14 +3,12 @@ import { loadUserThemeFromCookies, saveTheme, useGlobal } from '@/lib/global' import { faMoon, faSun } from '@fortawesome/free-solid-svg-icons' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' -let windowTop = 0 export default function FloatDarkModeButton () { const [show, switchShow] = useState(false) const scrollListener = () => { const scrollY = window.pageYOffset // const shouldShow = scrollY > 100 && scrollY < windowTop const shouldShow = scrollY > 100 - windowTop = scrollY if (shouldShow !== show) { switchShow(shouldShow) } diff --git a/components/JumpToTopButton.js b/components/JumpToTopButton.js index 1e6d375d..9297da01 100644 --- a/components/JumpToTopButton.js +++ b/components/JumpToTopButton.js @@ -4,8 +4,6 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faArrowUp } from '@fortawesome/free-solid-svg-icons' import smoothscroll from 'smoothscroll-polyfill' -let windowTop = 0 - /** * 跳转到网页顶部 * 当屏幕下滑500像素后会出现该控件 @@ -27,7 +25,6 @@ const JumpToTopButton = ({ targetRef, showPercent = true }) => { if (per > 100) per = 100 // const shouldShow = scrollY > 100 && per > 0 && scrollY < windowTop const shouldShow = scrollY > 100 && per > 0 - windowTop = scrollY if (shouldShow !== show) { switchShow(shouldShow) diff --git a/components/TocDrawerButton.js b/components/TocDrawerButton.js index 6fe83074..2b066988 100644 --- a/components/TocDrawerButton.js +++ b/components/TocDrawerButton.js @@ -3,7 +3,6 @@ import { useGlobal } from '@/lib/global' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faListOl } from '@fortawesome/free-solid-svg-icons' -let windowTop = 0 /** * 点击召唤目录抽屉 * 当屏幕下滑500像素后会出现该控件 @@ -16,9 +15,7 @@ const TocDrawerButton = (props) => { const [show, switchShow] = useState(false) const scrollListener = () => { const scrollY = window.pageYOffset - // const shouldShow = scrollY > 100 && scrollY < windowTop const shouldShow = scrollY > 100 - windowTop = scrollY if (shouldShow !== show) { switchShow(shouldShow) diff --git a/components/TopNav.js b/components/TopNav.js index 48108b46..1f9c4e42 100644 --- a/components/TopNav.js +++ b/components/TopNav.js @@ -1,11 +1,9 @@ import { useRef } from 'react' import SideBarDrawer from '@/components/SideBarDrawer' -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import BLOG from '@/blog.config' import Link from 'next/link' import Image from 'next/image' import { useGlobal } from '@/lib/global' -import { faSearch } from '@fortawesome/free-solid-svg-icons' const TopNav = ({ tags, currentTag, post, posts, categories, currentCategory }) => { const drawer = useRef() diff --git a/pages/archive/index.js b/pages/archive/index.js index e1aa52a3..e1220044 100644 --- a/pages/archive/index.js +++ b/pages/archive/index.js @@ -2,12 +2,9 @@ import { getAllCategories, getAllPosts, getAllTags } from '@/lib/notion' import BLOG from '@/blog.config' import BaseLayout from '@/layouts/BaseLayout' import { getNotionPageData } from '@/lib/notion/getNotionData' -import StickyBar from '@/components/StickyBar' import React, { useEffect } from 'react' import { useGlobal } from '@/lib/global' import BlogPostArchive from '@/components/BlogPostArchive' -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' -import { faArchive } from '@fortawesome/free-solid-svg-icons' export async function getStaticProps () { const from = 'index'