From 8311909062ec6166d36b13ecdfe6035861c6ae7e Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 25 Sep 2024 15:03:35 +0800 Subject: [PATCH] nobelium darkmode --- themes/nobelium/components/Nav.js | 25 +++++++++++++------------ themes/nobelium/config.js | 1 + 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/themes/nobelium/components/Nav.js b/themes/nobelium/components/Nav.js index a187b7df..015c899a 100644 --- a/themes/nobelium/components/Nav.js +++ b/themes/nobelium/components/Nav.js @@ -1,4 +1,5 @@ import Collapse from '@/components/Collapse' +import DarkModeButton from '@/components/DarkModeButton' import LazyImage from '@/components/LazyImage' import { siteConfig } from '@/lib/config' import { useGlobal } from '@/lib/global' @@ -54,7 +55,7 @@ const Nav = props => {
{/* */} - {siteConfig('NOBELIUM_NAV_NOTION_ICON', null, CONFIG) ? ( + {siteConfig('NOBELIUM_NAV_NOTION_ICON') ? ( { id: 2, name: locale.NAV.RSS, href: '/feed', - show: - siteConfig('ENABLE_RSS') && - siteConfig('NOBELIUM_MENU_RSS', null, CONFIG), + show: siteConfig('ENABLE_RSS') && siteConfig('NOBELIUM_MENU_RSS'), target: '_blank' }, { icon: 'fas fa-search', name: locale.NAV.SEARCH, href: '/search', - show: siteConfig('NOBELIUM_MENU_SEARCH', null, CONFIG) + show: siteConfig('NOBELIUM_MENU_SEARCH') }, { icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, href: '/archive', - show: siteConfig('NOBELIUM_MENU_ARCHIVE', null, CONFIG) + show: siteConfig('NOBELIUM_MENU_ARCHIVE') }, { icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, href: '/category', - show: siteConfig('NOBELIUM_MENU_CATEGORY', null, CONFIG) + show: siteConfig('NOBELIUM_MENU_CATEGORY') }, { icon: 'fas fa-tag', name: locale.COMMON.TAGS, href: '/tag', - show: siteConfig('NOBELIUM_MENU_TAG', null, CONFIG) + show: siteConfig('NOBELIUM_MENU_TAG') } ] if (customNav) { @@ -167,12 +166,14 @@ const NavBar = props => {
- {JSON.parse(siteConfig('NOBELIUM_MENU_RANDOM_POST', null, CONFIG)) && ( + {siteConfig('NOBELIUM_MENU_DARKMODE_BUTTON') && ( + + )} + + {siteConfig('NOBELIUM_MENU_RANDOM_POST') && ( )} - {JSON.parse(siteConfig('NOBELIUM_MENU_SEARCH_BUTTON', null, CONFIG)) && ( - - )} + {siteConfig('NOBELIUM_MENU_SEARCH_BUTTON') && } diff --git a/themes/nobelium/config.js b/themes/nobelium/config.js index 905a40e1..8dfe5895 100644 --- a/themes/nobelium/config.js +++ b/themes/nobelium/config.js @@ -4,6 +4,7 @@ const CONFIG = { // 特殊菜单 NOBELIUM_MENU_RANDOM_POST: true, // 是否显示随机跳转文章按钮 NOBELIUM_MENU_SEARCH_BUTTON: true, // 是否显示搜索按钮,该按钮支持Algolia搜索 + NOBELIUM_MENU_DARKMODE_BUTTON: true, // 菜单显示深色模式切换 // 默认菜单配置 (开启自定义菜单后,以下配置则失效,请在Notion中自行配置菜单) NOBELIUM_MENU_CATEGORY: false, // 显示分类