diff --git a/themes/hexo/components/Header.js b/themes/hexo/components/Header.js index e1fbd29a..6497f95c 100644 --- a/themes/hexo/components/Header.js +++ b/themes/hexo/components/Header.js @@ -1,6 +1,7 @@ import { useEffect, useState } from 'react' import Typed from 'typed.js' import CONFIG_HEXO from '../config_hexo' +import NavButtonGroup from './NavButtonGroup' let wrapperTop = 0 let windowTop = 0 @@ -74,7 +75,7 @@ const Header = props => { className="duration-500 md:bg-fixed w-full bg-cover bg-center h-screen bg-black text-white" style={{ backgroundImage: - `linear-gradient(rgba(0, 0, 0, 0.8), rgba(0,0,0,0.2), rgba(0,0,0,0.2), rgba(0,0,0,0.2), rgba(0, 0, 0, 0.8) ),url("${siteInfo?.pageCover}")` + `linear-gradient(rgba(0, 0, 0, 0.9), rgba(0,0,0,0.5), rgba(0,0,0,0.3), rgba(0,0,0,0.5), rgba(0, 0, 0, 0.9) ),url("${siteInfo?.pageCover}")` }} >
@@ -82,6 +83,10 @@ const Header = props => {
+ + {/* 首页导航插件 */} + { CONFIG_HEXO.HOME_NAV_BUTTONS && } +
{ diff --git a/themes/hexo/components/Logo.js b/themes/hexo/components/Logo.js index e1adeb3d..f281cb99 100644 --- a/themes/hexo/components/Logo.js +++ b/themes/hexo/components/Logo.js @@ -6,7 +6,7 @@ const Logo = props => { const { siteInfo } = props return
-
{siteInfo?.title || BLOG.TITLE}
+
{siteInfo?.title || BLOG.TITLE}
} diff --git a/themes/hexo/components/MenuButtonGroupTop.js b/themes/hexo/components/MenuButtonGroupTop.js index c8d087fc..d27dfc69 100644 --- a/themes/hexo/components/MenuButtonGroupTop.js +++ b/themes/hexo/components/MenuButtonGroupTop.js @@ -9,9 +9,9 @@ const MenuButtonGroupTop = (props) => { let links = [ { icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG_HEXO.MENU_SEARCH }, - { icon: 'fas fa-archive', name: locale.COMMON.ARTICLE, to: '/archive', show: CONFIG_HEXO.MENU_ARCHIVE }, - { icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_HEXO.MENU_CATEGORY }, - { icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_HEXO.MENU_TAG } + { icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG_HEXO.MENU_ARCHIVE } + // { icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_HEXO.MENU_CATEGORY }, + // { icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_HEXO.MENU_TAG } ] if (customNav) { @@ -22,8 +22,8 @@ const MenuButtonGroupTop = (props) => { {links.map(link => { if (link.show) { return - -
+ +
{link.name}
diff --git a/themes/hexo/components/NavButtonGroup.js b/themes/hexo/components/NavButtonGroup.js new file mode 100644 index 00000000..e33f7f8c --- /dev/null +++ b/themes/hexo/components/NavButtonGroup.js @@ -0,0 +1,21 @@ + +import React from 'react' +import Link from 'next/link' + +/** + * 首页导航大按钮组件 + * @param {*} props + * @returns + */ +const NavButtonGroup = (props) => { + const { categories } = props + + return
+} +export default NavButtonGroup diff --git a/themes/hexo/components/TopNav.js b/themes/hexo/components/TopNav.js index 3cd3528f..1969fe3d 100644 --- a/themes/hexo/components/TopNav.js +++ b/themes/hexo/components/TopNav.js @@ -30,6 +30,7 @@ const TopNav = props => { const nav = document.querySelector('#sticky-nav') const header = document.querySelector('#header') const showNav = scrollS <= windowTop || scrollS < 5 || (header && scrollS <= header.clientHeight)// 非首页无大图时影藏顶部 滚动条置顶时隐藏 + // 是否将导航栏透明 const navTransparent = (scrollS < document.documentElement.clientHeight - 12 && router.route === '/') || scrollS < 300 // 透明导航条的条件 if (header && navTransparent) { @@ -37,11 +38,13 @@ const TopNav = props => { nav && nav.classList.replace('text-black', 'text-white') nav && nav.classList.replace('border', 'border-transparent') nav && nav.classList.replace('shadow-md', 'shadow-none') + nav && nav.classList.replace('dark:bg-hexo-black-gray', 'transparent') } else { nav && nav.classList.replace('bg-none', 'bg-white') nav && nav.classList.replace('text-white', 'text-black') nav && nav.classList.replace('border-transparent', 'border') nav && nav.classList.replace('shadow-none', 'shadow-md') + nav && nav.classList.replace('transparent', 'dark:bg-hexo-black-gray') } if (!showNav) { @@ -118,7 +121,7 @@ const TopNav = props => { {/* 导航栏 */} -