From b22a53c6a3c8e0505ff0155aca9b3c356064a1ba Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Mon, 3 Jun 2024 15:45:51 +0800 Subject: [PATCH 1/5] Update README_EN.md --- README_EN.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README_EN.md b/README_EN.md index dbb75684a73..dd4063e5944 100644 --- a/README_EN.md +++ b/README_EN.md @@ -35,15 +35,15 @@ Live Demo:[https://preview.tangly1024.com/](https://preview.tangly1024.com/) It only takes a few minutes to set up your personal site: -- [Quick Deployment Tutorial - Multiple Options Available](https://tangly1024.com/article/notion-next) +- [Quick Deployment Tutorial - Multiple Options Available](https://docs.tangly1024.com/article/vercel-deploy-notion-next) -- [Customization Guide - How to Configure Feature Plugins](https://tangly1024.com/article/notion-next-guide) +- [Customization Guide - How to Configure Feature Plugins](https://docs.tangly1024.com/article/how-to-config-notion-next) -- [Development Guide - How to Conduct Local Development](https://tangly1024.com/article/how-to-develop-with-notion-next) +- [Development Guide - How to Conduct Local Development](https://docs.tangly1024.com/article/how-to-develop-with-notion-next) -- [Update Guide - How to Get the Latest Upgrade Patch](https://tangly1024.com/article/how-to-update-notionnext) +- [Update Guide - How to Get the Latest Upgrade Patch](https://docs.tangly1024.com/article/how-to-update-notionnext) -- [Version History - Check Feature Highlights for Each Version](https://tangly1024.com/article/notion-next-changelogs) +- [Version History - Check Feature Highlights for Each Version](https://docs.tangly1024.com/article/latest) ## Acknowledgements From 1f5b77406adf1bf51b02331cb0e22654763faa8e Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Mon, 3 Jun 2024 18:02:09 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=8A=A8=E6=95=88=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E7=89=B9=E6=AE=8A=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Fireworks.js | 6 +++++- components/MouseFollow.js | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/components/Fireworks.js b/components/Fireworks.js index cb6a2d98473..e61585f1682 100644 --- a/components/Fireworks.js +++ b/components/Fireworks.js @@ -35,7 +35,11 @@ const Fireworks = () => { loadFireworks() return () => { - // 在组件卸载时清理资源(如果需要) + // 在组件卸载时清理资源 + const fireworksElements = document.getElementsByClassName('fireworks') + while (fireworksElements.length > 0) { + fireworksElements[0].parentNode.removeChild(fireworksElements[0]) + } } }, []) diff --git a/components/MouseFollow.js b/components/MouseFollow.js index 2215a0cef9a..cc10d29c672 100644 --- a/components/MouseFollow.js +++ b/components/MouseFollow.js @@ -15,8 +15,26 @@ const MOUSE_FOLLOW = () => { loadExternalResource('/js/mouse-follow.js', 'js').then(url => { window.createMouseCanvas && window.createMouseCanvas()({ type, color }) }) + + return () => { + // 在组件卸载时清理资源 + const mouseFollowElement = document.getElementById('vixcityCanvas') + mouseFollowElement?.parentNode?.removeChild(mouseFollowElement) + } }, []) - return <> + return ( + <> + + + ) } export default MOUSE_FOLLOW From 71106860bd4c97f67cf4f7cdffa0018c883c5d96 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Mon, 3 Jun 2024 18:02:23 +0800 Subject: [PATCH 3/5] =?UTF-8?q?gitbook=20=E5=B8=83=E5=B1=80=E4=BA=A4?= =?UTF-8?q?=E4=BA=92=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/CatalogDrawerWrapper.js | 60 +++++++++++++++++++ themes/gitbook/components/FloatTocButton.js | 25 -------- themes/gitbook/components/Header.js | 2 +- themes/gitbook/components/JumpToTopButton.js | 24 ++++---- themes/gitbook/components/LogoBar.js | 12 ---- .../gitbook/components/MobileButtonCatalog.js | 27 +++++++++ .../gitbook/components/MobileButtonPageNav.js | 27 +++++++++ themes/gitbook/components/PageNavDrawer.js | 12 +++- themes/gitbook/components/TocDrawer.js | 34 ----------- themes/gitbook/index.js | 24 +++++--- themes/gitbook/style.js | 16 +++-- themes/nav/components/FloatButtonCatalog.js | 27 +++++++++ themes/nav/components/FloatTocButton.js | 25 -------- themes/nav/index.js | 4 +- 14 files changed, 195 insertions(+), 124 deletions(-) create mode 100644 themes/gitbook/components/CatalogDrawerWrapper.js delete mode 100644 themes/gitbook/components/FloatTocButton.js create mode 100644 themes/gitbook/components/MobileButtonCatalog.js create mode 100644 themes/gitbook/components/MobileButtonPageNav.js delete mode 100644 themes/gitbook/components/TocDrawer.js create mode 100644 themes/nav/components/FloatButtonCatalog.js delete mode 100755 themes/nav/components/FloatTocButton.js diff --git a/themes/gitbook/components/CatalogDrawerWrapper.js b/themes/gitbook/components/CatalogDrawerWrapper.js new file mode 100644 index 00000000000..3b6ee8daa0d --- /dev/null +++ b/themes/gitbook/components/CatalogDrawerWrapper.js @@ -0,0 +1,60 @@ +import { useGlobal } from '@/lib/global' +import { useGitBookGlobal } from '@/themes/gitbook' +import Catalog from './Catalog' + +/** + * 悬浮抽屉目录 + * @param toc + * @param post + * @returns {JSX.Element} + * @constructor + */ +const CatalogDrawerWrapper = ({ post, cRef }) => { + const { tocVisible, changeTocVisible } = useGitBookGlobal() + const { locale } = useGlobal() + const switchVisible = () => { + changeTocVisible(!tocVisible) + } + return ( + <> +
+ {/* 侧边菜单 */} +
+ {post && ( + <> +
+ {locale.COMMON.TABLE_OF_CONTENTS} + { + changeTocVisible(false) + }}> +
+
+ +
+ + )} +
+
+ {/* 背景蒙版 */} +
+ + ) +} +export default CatalogDrawerWrapper diff --git a/themes/gitbook/components/FloatTocButton.js b/themes/gitbook/components/FloatTocButton.js deleted file mode 100644 index 4215f44743b..00000000000 --- a/themes/gitbook/components/FloatTocButton.js +++ /dev/null @@ -1,25 +0,0 @@ -import { useGitBookGlobal } from '@/themes/gitbook' - -/** - * 移动端悬浮目录按钮 - */ -export default function FloatTocButton () { - const { tocVisible, changeTocVisible } = useGitBookGlobal() - - const toggleToc = () => { - changeTocVisible(!tocVisible) - } - - return ( -
- -
- ) -} diff --git a/themes/gitbook/components/Header.js b/themes/gitbook/components/Header.js index 8dfb3735820..8d5387403ee 100644 --- a/themes/gitbook/components/Header.js +++ b/themes/gitbook/components/Header.js @@ -90,7 +90,7 @@ export default function Header(props) { {isOpen ? ( ) : ( - + )}
diff --git a/themes/gitbook/components/JumpToTopButton.js b/themes/gitbook/components/JumpToTopButton.js index 0afdbb6c8ba..21b53733e9a 100644 --- a/themes/gitbook/components/JumpToTopButton.js +++ b/themes/gitbook/components/JumpToTopButton.js @@ -1,4 +1,3 @@ - /** * 跳转到网页顶部 * 当屏幕下滑500像素后会出现该控件 @@ -9,15 +8,20 @@ */ const JumpToTopButton = ({ showPercent = false, percent, className }) => { return ( -
- { window.scrollTo({ top: 0, behavior: 'smooth' }) }} /> -
+
+ { + window.scrollTo({ top: 0, behavior: 'smooth' }) + }} + /> +
) } diff --git a/themes/gitbook/components/LogoBar.js b/themes/gitbook/components/LogoBar.js index c2d1c453e86..dfe3caddcae 100644 --- a/themes/gitbook/components/LogoBar.js +++ b/themes/gitbook/components/LogoBar.js @@ -1,6 +1,5 @@ import LazyImage from '@/components/LazyImage' import { siteConfig } from '@/lib/config' -import { useGitBookGlobal } from '@/themes/gitbook' import Link from 'next/link' import CONFIG from '../config' @@ -11,19 +10,8 @@ import CONFIG from '../config' */ export default function LogoBar(props) { const { siteInfo } = props - const { pageNavVisible, changePageNavVisible } = useGitBookGlobal() - - const togglePageNavVisible = () => { - changePageNavVisible(!pageNavVisible) - } return (
-
- -
diff --git a/themes/gitbook/components/MobileButtonCatalog.js b/themes/gitbook/components/MobileButtonCatalog.js new file mode 100644 index 00000000000..2c61289493c --- /dev/null +++ b/themes/gitbook/components/MobileButtonCatalog.js @@ -0,0 +1,27 @@ +import { useGitBookGlobal } from '@/themes/gitbook' + +/** + * 移动端目录按钮 + */ +export default function MobileButtonCatalog() { + const { tocVisible, changeTocVisible } = useGitBookGlobal() + + const toggleToc = () => { + changeTocVisible(!tocVisible) + } + + return ( +
+ ) +} diff --git a/themes/gitbook/components/MobileButtonPageNav.js b/themes/gitbook/components/MobileButtonPageNav.js new file mode 100644 index 00000000000..65a3c39ad2a --- /dev/null +++ b/themes/gitbook/components/MobileButtonPageNav.js @@ -0,0 +1,27 @@ +import { useGitBookGlobal } from '@/themes/gitbook' + +/** + * 移动端文章导航按钮 + */ +export default function MobileButtonPageNav() { + const { pageNavVisible, changePageNavVisible } = useGitBookGlobal() + + const togglePageNavVisible = () => { + changePageNavVisible(!pageNavVisible) + } + + return ( + + ) +} diff --git a/themes/gitbook/components/PageNavDrawer.js b/themes/gitbook/components/PageNavDrawer.js index b5657d18ff6..eb927762789 100644 --- a/themes/gitbook/components/PageNavDrawer.js +++ b/themes/gitbook/components/PageNavDrawer.js @@ -1,3 +1,4 @@ +import { useGlobal } from '@/lib/global' import { useGitBookGlobal } from '@/themes/gitbook' import NavPostList from './NavPostList' @@ -11,6 +12,7 @@ import NavPostList from './NavPostList' const PageNavDrawer = props => { const { pageNavVisible, changePageNavVisible } = useGitBookGlobal() const { filteredNavPages } = props + const { locale } = useGlobal() const switchVisible = () => { changePageNavVisible(!pageNavVisible) @@ -24,7 +26,15 @@ const PageNavDrawer = props => { {/* 侧边菜单 */}
+ overflow-y-hidden shadow-card w-72 duration-200 fixed left-1 bottom-16 rounded py-2 bg-white dark:bg-hexo-black-gray`}> +
+ {locale.COMMON.ARTICLE} + { + changePageNavVisible(false) + }}> +
{/* 所有文章列表 */}
diff --git a/themes/gitbook/components/TocDrawer.js b/themes/gitbook/components/TocDrawer.js deleted file mode 100644 index 7b07044ad09..00000000000 --- a/themes/gitbook/components/TocDrawer.js +++ /dev/null @@ -1,34 +0,0 @@ -import { useGitBookGlobal } from '@/themes/gitbook' -import Catalog from './Catalog' - -/** - * 悬浮抽屉目录 - * @param toc - * @param post - * @returns {JSX.Element} - * @constructor - */ -const TocDrawer = ({ post, cRef }) => { - const { tocVisible, changeTocVisible } = useGitBookGlobal() - const switchVisible = () => { - changeTocVisible(!tocVisible) - } - return <> -
- {/* 侧边菜单 */} -
- {post && <> -
- -
- } -
-
- {/* 背景蒙版 */} -
- -} -export default TocDrawer diff --git a/themes/gitbook/index.js b/themes/gitbook/index.js index 34c4f05d021..9fe1682e9a6 100644 --- a/themes/gitbook/index.js +++ b/themes/gitbook/index.js @@ -20,18 +20,19 @@ import ArticleInfo from './components/ArticleInfo' import { ArticleLock } from './components/ArticleLock' import BlogArchiveItem from './components/BlogArchiveItem' import Catalog from './components/Catalog' +import CatalogDrawerWrapper from './components/CatalogDrawerWrapper' import CategoryItem from './components/CategoryItem' -import FloatTocButton from './components/FloatTocButton' import Footer from './components/Footer' import Header from './components/Header' import InfoCard from './components/InfoCard' import JumpToTopButton from './components/JumpToTopButton' +import MobileButtonCatalog from './components/MobileButtonCatalog' +import MobileButtonPageNav from './components/MobileButtonPageNav' import NavPostList from './components/NavPostList' import PageNavDrawer from './components/PageNavDrawer' import RevolverMaps from './components/RevolverMaps' import SearchInput from './components/SearchInput' import TagItemMini from './components/TagItemMini' -import TocDrawer from './components/TocDrawer' import CONFIG from './config' import { Style } from './style' @@ -211,6 +212,7 @@ const LayoutBase = props => {
+ {/* 桌面端目录 */} {slotRight} {router.route === '/' && ( @@ -235,12 +237,17 @@ const LayoutBase = props => { )} - {/* 移动端悬浮目录按钮 */} - {showTocButton && !tocVisible && ( -
- + {/* 移动端底部按钮 */} +
+
+
- )} + {showTocButton && ( +
+ +
+ )} +
{/* 移动端导航抽屉 */} @@ -366,7 +373,8 @@ const LayoutSlug = props => { )} - + {/* 文章目录 */} +
)} diff --git a/themes/gitbook/style.js b/themes/gitbook/style.js index 5e8eaa5a2a3..904da2a7560 100644 --- a/themes/gitbook/style.js +++ b/themes/gitbook/style.js @@ -5,14 +5,18 @@ * @returns */ const Style = () => { - return + .bottom-button-group { + box-shadow: 0px -3px 10px 0px rgba(0, 0, 0, 0.1); + } + `} + ) } export { Style } diff --git a/themes/nav/components/FloatButtonCatalog.js b/themes/nav/components/FloatButtonCatalog.js new file mode 100644 index 00000000000..753451da002 --- /dev/null +++ b/themes/nav/components/FloatButtonCatalog.js @@ -0,0 +1,27 @@ +import { useNavGlobal } from '@/themes/nav' + +/** + * 移动端悬浮目录按钮 + */ +export default function FloatButtonCatalog() { + const { tocVisible, changeTocVisible } = useNavGlobal() + + const toggleToc = () => { + changeTocVisible(!tocVisible) + } + + return ( +
+ ) +} diff --git a/themes/nav/components/FloatTocButton.js b/themes/nav/components/FloatTocButton.js deleted file mode 100755 index d4ff317d186..00000000000 --- a/themes/nav/components/FloatTocButton.js +++ /dev/null @@ -1,25 +0,0 @@ -import { useNavGlobal } from '@/themes/nav' - -/** - * 移动端悬浮目录按钮 - */ -export default function FloatTocButton () { - const { tocVisible, changeTocVisible } = useNavGlobal() - - const toggleToc = () => { - changeTocVisible(!tocVisible) - } - - return ( - - ) -} diff --git a/themes/nav/index.js b/themes/nav/index.js index 54cea4b8acb..4a9bd72415e 100755 --- a/themes/nav/index.js +++ b/themes/nav/index.js @@ -25,7 +25,7 @@ import BlogArchiveItem from './components/BlogArchiveItem' import BlogPostCard from './components/BlogPostCard' import BlogPostListAll from './components/BlogPostListAll' import CategoryItem from './components/CategoryItem' -import FloatTocButton from './components/FloatTocButton' +import FloatButtonCatalog from './components/FloatButtonCatalog' import Footer from './components/Footer' import JumpToTopButton from './components/JumpToTopButton' import LogoBar from './components/LogoBar' @@ -187,7 +187,7 @@ const LayoutBase = props => { {/* 移动端悬浮目录按钮 */} {showTocButton && !tocVisible && (
- +
)} From 3a62c471276d65d800e7032bf7da805fc8a26adb Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Mon, 3 Jun 2024 18:15:48 +0800 Subject: [PATCH 4/5] =?UTF-8?q?gitbook=20=E4=B8=BB=E9=A2=98=E4=BA=BF?= =?UTF-8?q?=E7=82=B9=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/gitbook/components/Footer.js | 70 ++++++++++++++++++++--------- themes/gitbook/index.js | 22 ++++----- 2 files changed, 60 insertions(+), 32 deletions(-) diff --git a/themes/gitbook/components/Footer.js b/themes/gitbook/components/Footer.js index 78a91cd59aa..d0e2a1504d3 100644 --- a/themes/gitbook/components/Footer.js +++ b/themes/gitbook/components/Footer.js @@ -4,30 +4,56 @@ const Footer = ({ siteInfo }) => { const d = new Date() const currentYear = d.getFullYear() const since = siteConfig('SINCE') - const copyrightDate = parseInt(since) < currentYear ? since + '-' + currentYear : currentYear + const copyrightDate = + parseInt(since) < currentYear ? since + '-' + currentYear : currentYear return ( -
+ ) } diff --git a/themes/gitbook/index.js b/themes/gitbook/index.js index 9fe1682e9a6..89240a633a9 100644 --- a/themes/gitbook/index.js +++ b/themes/gitbook/index.js @@ -140,9 +140,8 @@ const LayoutBase = props => {
{/* 左侧推拉抽屉 */} {fullWidth ? null : ( @@ -150,16 +149,19 @@ const LayoutBase = props => { className={ 'hidden md:block border-r dark:border-transparent relative z-10 dark:bg-hexo-black-gray' }> -
- {slotLeft} - -
+
+ {/* 导航 */} +
+ {/* 嵌入 */} + {slotLeft} + {/* 搜索框 */} + + + {/* 文章列表 */} {/* 所有文章列表 */}
-
- -
+ {/* 页脚 */}
From dc7e53343cfeb18cd8f49ca0f0afb0cc6ebea521 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Mon, 3 Jun 2024 18:47:52 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fukasawa=20=E4=B8=80=E7=82=B9=E5=BE=AE?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/fukasawa/components/AsideLeft.js | 205 ++++++++++++--------- themes/fukasawa/components/Header.js | 64 +++++++ themes/fukasawa/components/TopNav.js | 50 ----- themes/fukasawa/index.js | 233 ++++++++++++++---------- 4 files changed, 320 insertions(+), 232 deletions(-) create mode 100644 themes/fukasawa/components/Header.js delete mode 100644 themes/fukasawa/components/TopNav.js diff --git a/themes/fukasawa/components/AsideLeft.js b/themes/fukasawa/components/AsideLeft.js index f534d1b68c8..b0ea23131ba 100644 --- a/themes/fukasawa/components/AsideLeft.js +++ b/themes/fukasawa/components/AsideLeft.js @@ -1,22 +1,22 @@ -import Logo from './Logo' -import GroupCategory from './GroupCategory' -import { MenuList } from './MenuList' -import GroupTag from './GroupTag' -import SearchInput from './SearchInput' -import SiteInfo from './SiteInfo' -import Catalog from './Catalog' -import Announcement from './Announcement' -import { useRouter } from 'next/router' import DarkModeButton from '@/components/DarkModeButton' -import SocialButton from './SocialButton' -import CONFIG from '@/themes/fukasawa/config' import { AdSlot } from '@/components/GoogleAdsense' import { siteConfig } from '@/lib/config' -import MailChimpForm from './MailChimpForm' import { useGlobal } from '@/lib/global' -import { useEffect, useMemo, useState } from 'react' import { isBrowser } from '@/lib/utils' +import CONFIG from '@/themes/fukasawa/config' import { debounce } from 'lodash' +import { useRouter } from 'next/router' +import { useEffect, useMemo, useState } from 'react' +import Announcement from './Announcement' +import Catalog from './Catalog' +import GroupCategory from './GroupCategory' +import GroupTag from './GroupTag' +import Logo from './Logo' +import MailChimpForm from './MailChimpForm' +import { MenuList } from './MenuList' +import SearchInput from './SearchInput' +import SiteInfo from './SiteInfo' +import SocialButton from './SocialButton' /** * 侧边栏 @@ -24,16 +24,41 @@ import { debounce } from 'lodash' * @returns */ function AsideLeft(props) { - const { tagOptions, currentTag, categoryOptions, currentCategory, post, slot, notice } = props + const { + tagOptions, + currentTag, + categoryOptions, + currentCategory, + post, + slot, + notice + } = props const router = useRouter() const { fullWidth } = useGlobal() - const FUKASAWA_SIDEBAR_COLLAPSE_SATUS_DEFAULT = fullWidth || siteConfig('FUKASAWA_SIDEBAR_COLLAPSE_SATUS_DEFAULT', null, CONFIG) + const FUKASAWA_SIDEBAR_COLLAPSE_SATUS_DEFAULT = + fullWidth || + siteConfig('FUKASAWA_SIDEBAR_COLLAPSE_SATUS_DEFAULT', null, CONFIG) + + const FUKASAWA_SIDEBAR_COLLAPSE_ON_SCROLL = siteConfig( + 'FUKASAWA_SIDEBAR_COLLAPSE_ON_SCROLL', + false, + CONFIG + ) + + const FUKASAWA_SIDEBAR_COLLAPSE_BUTTON = siteConfig( + 'FUKASAWA_SIDEBAR_COLLAPSE_BUTTON', + null, + CONFIG + ) // 侧边栏折叠从 本地存储中获取 open 状态的初始值 const [isCollapsed, setIsCollapse] = useState(() => { if (typeof window !== 'undefined') { - return localStorage.getItem('fukasawa-sidebar-collapse') === 'true' || FUKASAWA_SIDEBAR_COLLAPSE_SATUS_DEFAULT + return ( + localStorage.getItem('fukasawa-sidebar-collapse') === 'true' || + FUKASAWA_SIDEBAR_COLLAPSE_SATUS_DEFAULT + ) } return FUKASAWA_SIDEBAR_COLLAPSE_SATUS_DEFAULT }) @@ -69,7 +94,7 @@ function AsideLeft(props) { // 自动折叠侧边栏 onResize 窗口宽度小于1366 || 滚动条滚动至页面的300px时 ; 将open设置为false useEffect(() => { - if (!siteConfig('FUKASAWA_SIDEBAR_COLLAPSE_ON_SCROLL', false, CONFIG)) { + if (!FUKASAWA_SIDEBAR_COLLAPSE_ON_SCROLL) { return } const handleResize = debounce(() => { @@ -92,73 +117,89 @@ function AsideLeft(props) { } } }, []) - - - return