From bca48b01ec80d7eca35bba5304fd62d8ffc57398 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Mon, 28 Mar 2022 15:32:57 +0800 Subject: [PATCH] =?UTF-8?q?hexo=20=E6=B7=B1=E8=89=B2=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/hexo/LayoutSlug.js | 2 +- themes/hexo/components/ArticleCopyright.js | 2 +- themes/hexo/components/ArticleDetail.js | 2 +- themes/hexo/components/BlogPostCard.js | 2 +- themes/hexo/components/Card.js | 2 +- themes/hexo/components/HeaderArticle.js | 13 +++++++++++++ themes/hexo/components/MenuButtonGroupTop.js | 2 +- themes/hexo/components/TopNav.js | 4 ++-- 8 files changed, 21 insertions(+), 8 deletions(-) diff --git a/themes/hexo/LayoutSlug.js b/themes/hexo/LayoutSlug.js index 76ff42de..0fac6b7c 100644 --- a/themes/hexo/LayoutSlug.js +++ b/themes/hexo/LayoutSlug.js @@ -53,7 +53,7 @@ export const LayoutSlug = props => { showTag={false} floatSlot={floatSlot} > -
+
{!lock && } {lock && }
diff --git a/themes/hexo/components/ArticleCopyright.js b/themes/hexo/components/ArticleCopyright.js index 9275a664..9e7d79f6 100644 --- a/themes/hexo/components/ArticleCopyright.js +++ b/themes/hexo/components/ArticleCopyright.js @@ -17,7 +17,7 @@ export default function ArticleCopyright () { const { locale } = useGlobal() return
-
    +
    • {locale.COMMON.AUTHOR}: diff --git a/themes/hexo/components/ArticleDetail.js b/themes/hexo/components/ArticleDetail.js index 8ba94250..7913e6c6 100644 --- a/themes/hexo/components/ArticleDetail.js +++ b/themes/hexo/components/ArticleDetail.js @@ -76,7 +76,7 @@ export default function ArticleDetail (props) {
      {/* 评论互动 */} -
      +
      ) diff --git a/themes/hexo/components/BlogPostCard.js b/themes/hexo/components/BlogPostCard.js index 6fae258b..3087ea17 100644 --- a/themes/hexo/components/BlogPostCard.js +++ b/themes/hexo/components/BlogPostCard.js @@ -8,7 +8,7 @@ import CONFIG_HEXO from '../config_hexo' const BlogPostCard = ({ post, showSummary }) => { const showPreview = CONFIG_HEXO.POST_LIST_PREVIEW && post.blockMap return ( -
      +
      diff --git a/themes/hexo/components/Card.js b/themes/hexo/components/Card.js index c5c2aeb3..feda0330 100644 --- a/themes/hexo/components/Card.js +++ b/themes/hexo/components/Card.js @@ -1,7 +1,7 @@ const Card = ({ children, headerSlot, className }) => { return
      <>{headerSlot} -
      +
      {children}
      diff --git a/themes/hexo/components/HeaderArticle.js b/themes/hexo/components/HeaderArticle.js index ffb43bd7..1f9438dd 100644 --- a/themes/hexo/components/HeaderArticle.js +++ b/themes/hexo/components/HeaderArticle.js @@ -6,6 +6,7 @@ import { useEffect } from 'react' export default function HeaderArticle ({ post }) { const headerImage = post?.page_cover ? `url("${post.page_cover}")` : `url("/${CONFIG_HEXO.HOME_BANNER_IMAGE}")` + const { isDarkMode } = useGlobal() const { locale } = useGlobal() const date = formatDate( @@ -24,6 +25,7 @@ export default function HeaderArticle ({ post }) { nav && nav.classList.replace('bg-none', 'bg-white') nav && nav.classList.replace('text-white', 'text-black') } + updateTopNav() } useEffect(() => { scrollTrigger() @@ -33,6 +35,17 @@ export default function HeaderArticle ({ post }) { } }) + const updateTopNav = () => { + if (!isDarkMode) { + const stickyNavElement = document.getElementById('sticky-nav') + if (window.scrollY < window.innerHeight) { + stickyNavElement?.classList?.add('dark') + } else { + stickyNavElement?.classList?.remove('dark') + } + } + } + return (