- {siteConfig('TITLE')}
+ {siteInfo?.title || siteConfig('TITLE')}
diff --git a/themes/matery/components/Logo.js b/themes/matery/components/Logo.js
index 3e6542f4ebc..a1082ae3a89 100644
--- a/themes/matery/components/Logo.js
+++ b/themes/matery/components/Logo.js
@@ -1,11 +1,20 @@
import { siteConfig } from '@/lib/config'
import Link from 'next/link'
-
+/**
+ * 站点logo
+ * 这里默认只支持纯文字
+ * @param {*} props
+ * @returns
+ */
const Logo = props => {
+ const { siteInfo } = props
return (
-
{siteConfig('TITLE') }
+
+ {' '}
+ {siteInfo?.title || siteConfig('TITLE')}
+
)
diff --git a/themes/matery/components/MenuItemCollapse.js b/themes/matery/components/MenuItemCollapse.js
index 6cd373f6d9b..0094fa86a59 100644
--- a/themes/matery/components/MenuItemCollapse.js
+++ b/themes/matery/components/MenuItemCollapse.js
@@ -72,7 +72,7 @@ export const MenuItemCollapse = ({ link }) => {
return (
+ className='cursor-pointer whitespace-nowrap dark:text-gray-200 w-full font-extralight dark:bg-black text-left px-5 justify-start bg-gray-100 hover:bg-indigo-500 dark:hover:bg-indigo-500 hover:text-white tracking-widest transition-all duration-200 border-b dark:border-gray-800 py-3 pr-6'>
diff --git a/themes/matery/components/MenuItemDrop.js b/themes/matery/components/MenuItemDrop.js
index f7373f7c328..93dfe7c6d2b 100644
--- a/themes/matery/components/MenuItemDrop.js
+++ b/themes/matery/components/MenuItemDrop.js
@@ -1,6 +1,9 @@
import Link from 'next/link'
import { useState } from 'react'
-
+/**
+ * 菜单
+ * 支持二级展开的菜单
+ */
export const MenuItemDrop = ({ link }) => {
const [show, changeShow] = useState(false)
const hasSubMenu = link?.subMenus?.length > 0
@@ -42,7 +45,7 @@ export const MenuItemDrop = ({ link }) => {
return (
+ className='cursor-pointer hover:bg-indigo-500 text-gray-900 hover:text-white tracking-widest transition-all duration-200 dark:border-gray-800 py-1 pr-6 pl-3'>
{link?.icon && }
diff --git a/themes/matery/components/MenuListTop.js b/themes/matery/components/MenuListTop.js
index 506f9c59167..04897f7ba4f 100644
--- a/themes/matery/components/MenuListTop.js
+++ b/themes/matery/components/MenuListTop.js
@@ -1,17 +1,42 @@
+import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
import CONFIG from '../config'
import { MenuItemDrop } from './MenuItemDrop'
-import { siteConfig } from '@/lib/config'
-
-export const MenuListTop = (props) => {
+/**
+ * 菜单列表
+ * 顶部导航栏用
+ * @param {*} props
+ * @returns
+ */
+export const MenuListTop = props => {
const { customNav, customMenu } = props
const { locale } = useGlobal()
let links = [
- { icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: siteConfig('MATERY_MENU_ARCHIVE', null, CONFIG) },
- { icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: siteConfig('MATERY_MENU_SEARCH', null, CONFIG) },
- { icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('MATERY_MENU_CATEGORY', null, CONFIG) },
- { icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('MATERY_MENU_TAG', null, CONFIG) }
+ {
+ icon: 'fas fa-archive',
+ name: locale.NAV.ARCHIVE,
+ to: '/archive',
+ show: siteConfig('MATERY_MENU_ARCHIVE', null, CONFIG)
+ },
+ {
+ icon: 'fas fa-search',
+ name: locale.NAV.SEARCH,
+ to: '/search',
+ show: siteConfig('MATERY_MENU_SEARCH', null, CONFIG)
+ },
+ {
+ icon: 'fas fa-folder',
+ name: locale.COMMON.CATEGORY,
+ to: '/category',
+ show: siteConfig('MATERY_MENU_CATEGORY', null, CONFIG)
+ },
+ {
+ icon: 'fas fa-tag',
+ name: locale.COMMON.TAGS,
+ to: '/tag',
+ show: siteConfig('MATERY_MENU_TAG', null, CONFIG)
+ }
]
if (customNav) {
@@ -29,7 +54,9 @@ export const MenuListTop = (props) => {
return (
)
}
diff --git a/themes/matery/style.js b/themes/matery/style.js
index 711670c9174..32918e9219b 100644
--- a/themes/matery/style.js
+++ b/themes/matery/style.js
@@ -5,27 +5,54 @@
* @returns
*/
const Style = () => {
- return
+ background: linear-gradient(
+ to bottom,
+ rgba(0, 0, 0, 0.5) 0%,
+ rgba(0, 0, 0, 0.2) 10%,
+ rgba(0, 0, 0, 0) 25%,
+ rgba(0, 0, 0, 0.2) 75%,
+ rgba(0, 0, 0, 0.5) 100%
+ );
+ }
+
+ // 自定义滚动条
+ ::-webkit-scrollbar {
+ width: 5px;
+ height: 5px;
+ }
+
+ ::-webkit-scrollbar-track {
+ background: transparent;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ background-color: #4338ca;
+ }
+
+ * {
+ scrollbar-width: thin;
+ scrollbar-color: #4338ca transparent;
+ }
+ `}
+ )
}
export { Style }
diff --git a/themes/medium/components/BottomMenuBar.js b/themes/medium/components/BottomMenuBar.js
index fee36eb2ed5..23979d9efa1 100644
--- a/themes/medium/components/BottomMenuBar.js
+++ b/themes/medium/components/BottomMenuBar.js
@@ -4,7 +4,7 @@ import JumpToTopButton from './JumpToTopButton'
export default function BottomMenuBar ({ post, className }) {
const { tocVisible, changeTocVisible } = useMediumGlobal()
- const showTocBotton = post?.toc?.length > 0
+ const showTocButton = post?.toc?.length > 0
const toggleToc = () => {
changeTocVisible(!tocVisible)
@@ -18,13 +18,13 @@ export default function BottomMenuBar ({ post, className }) {
-
+
- {showTocBotton &&
+ {showTocButton &&
}
- { !showTocBotton &&
+ { !showTocButton &&
diff --git a/themes/medium/index.js b/themes/medium/index.js
index 1e3f365d038..e35cdc28e93 100644
--- a/themes/medium/index.js
+++ b/themes/medium/index.js
@@ -51,12 +51,20 @@ const LayoutBase = props => {
const router = useRouter()
const [tocVisible, changeTocVisible] = useState(false)
const { onLoading, fullWidth } = useGlobal()
+ const [slotRight, setSlotRight] = useState(null);
+
+ useEffect(()=> {
+ if (post?.toc?.length > 0) {
+ setSlotRight(
+
+
+
+ );
+ } else {
+ setSlotRight(null);
+ }
+ },[post])
- const slotRight = post?.toc?.length > 0 && (
-
-
-
- )
const slotTop =
return (
@@ -178,7 +186,7 @@ const LayoutSlug = props => {
}, [post])
return (
-
+
{/* 文章锁 */}
{lock &&
}
diff --git a/themes/nobelium/components/Nav.js b/themes/nobelium/components/Nav.js
index 38253b43ac7..a30618ed4a0 100644
--- a/themes/nobelium/components/Nav.js
+++ b/themes/nobelium/components/Nav.js
@@ -1,24 +1,31 @@
-import { useEffect, useRef, useState } from 'react'
-import Link from 'next/link'
+import Collapse from '@/components/Collapse'
+import LazyImage from '@/components/LazyImage'
+import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
+import Link from 'next/link'
+import { useEffect, useRef, useState } from 'react'
import CONFIG from '../config'
-import { SvgIcon } from './SvgIcon'
-import { MenuItemDrop } from './MenuItemDrop'
-import Collapse from '@/components/Collapse'
import { MenuItemCollapse } from './MenuItemCollapse'
-import LazyImage from '@/components/LazyImage'
+import { MenuItemDrop } from './MenuItemDrop'
import RandomPostButton from './RandomPostButton'
import SearchButton from './SearchButton'
-import { siteConfig } from '@/lib/config'
-
+import { SvgIcon } from './SvgIcon'
+/**
+ * 顶部导航
+ */
const Nav = props => {
const { navBarTitle, fullWidth, siteInfo } = props
- const useSticky = !JSON.parse(siteConfig('NOBELIUM_AUTO_COLLAPSE_NAV_BAR', true))
+ const autoCollapseNavBar = siteConfig(
+ 'NOBELIUM_AUTO_COLLAPSE_NAV_BAR',
+ true,
+ CONFIG
+ )
+
const navRef = useRef(null)
const sentinalRef = useRef([])
const handler = ([entry]) => {
- if (navRef && navRef.current && useSticky) {
- if (!entry.isIntersecting && entry !== undefined) {
+ if (navRef && navRef.current && autoCollapseNavBar) {
+ if (!entry?.isIntersecting) {
navRef.current?.classList.add('sticky-nav-full')
} else {
navRef.current?.classList.remove('sticky-nav-full')
@@ -34,42 +41,46 @@ const Nav = props => {
if (sentinalRef.current) obvserver.unobserve(sentinalRef.current)
}
}, [sentinalRef])
- return <>
-
-
-
-
-
-
- {/* */}
- {siteConfig('NOBELIUM_NAV_NOTION_ICON', null, CONFIG)
- ?
- : }
-
-
-
-
- {navBarTitle
- ? (
-
- {navBarTitle}
-
- )
- : (
-
- {siteConfig('TITLE')}
- {/* ,{' '}{siteConfig('DESCRIPTION')} */}
-
- )}
+ return (
+ <>
+
+
+
+
+
+ {/* */}
+ {siteConfig('NOBELIUM_NAV_NOTION_ICON', null, CONFIG) ? (
+
+ ) : (
+
+ )}
-
+
+ {navBarTitle ? (
+
+ {navBarTitle}
+
+ ) : (
+
+ {siteConfig('TITLE')}
+ {/* ,{' '}{siteConfig('DESCRIPTION')} */}
+
+ )}
+
+
>
+ )
}
const NavBar = props => {
@@ -82,11 +93,39 @@ const NavBar = props => {
const { locale } = useGlobal()
let links = [
- { id: 2, name: locale.NAV.RSS, to: '/feed', show: siteConfig('ENABLE_RSS') && siteConfig('NOBELIUM_MENU_RSS', null, CONFIG), target: '_blank' },
- { icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: siteConfig('NOBELIUM_MENU_SEARCH', null, CONFIG) },
- { icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: siteConfig('NOBELIUM_MENU_ARCHIVE', null, CONFIG) },
- { icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('NOBELIUM_MENU_CATEGORY', null, CONFIG) },
- { icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('NOBELIUM_MENU_TAG', null, CONFIG) }
+ {
+ id: 2,
+ name: locale.NAV.RSS,
+ to: '/feed',
+ show:
+ siteConfig('ENABLE_RSS') &&
+ siteConfig('NOBELIUM_MENU_RSS', null, CONFIG),
+ target: '_blank'
+ },
+ {
+ icon: 'fas fa-search',
+ name: locale.NAV.SEARCH,
+ to: '/search',
+ show: siteConfig('NOBELIUM_MENU_SEARCH', null, CONFIG)
+ },
+ {
+ icon: 'fas fa-archive',
+ name: locale.NAV.ARCHIVE,
+ to: '/archive',
+ show: siteConfig('NOBELIUM_MENU_ARCHIVE', null, CONFIG)
+ },
+ {
+ icon: 'fas fa-folder',
+ name: locale.COMMON.CATEGORY,
+ to: '/category',
+ show: siteConfig('NOBELIUM_MENU_CATEGORY', null, CONFIG)
+ },
+ {
+ icon: 'fas fa-tag',
+ name: locale.COMMON.TAGS,
+ to: '/tag',
+ show: siteConfig('NOBELIUM_MENU_TAG', null, CONFIG)
+ }
]
if (customNav) {
links = links.concat(customNav)
@@ -102,22 +141,42 @@ const NavBar = props => {
}
return (
-
-
- {links?.map((link, index) => )}
-
-
-
-
- {links?.map((link, index) => collapseRef.current?.updateCollapseHeight(param)}/>)}
-
-
-
+
+
+ {links?.map((link, index) => (
+
+ ))}
+
+
+
+
+ {links?.map((link, index) => (
+
+ collapseRef.current?.updateCollapseHeight(param)
+ }
+ />
+ ))}
+
+
+
- {JSON.parse(siteConfig('NOBELIUM_MENU_RANDOM_POST', null, CONFIG)) &&
}
- {JSON.parse(siteConfig('NOBELIUM_MENU_SEARCH_BUTTON', null, CONFIG)) &&
}
-
-
+ {JSON.parse(siteConfig('NOBELIUM_MENU_RANDOM_POST', null, CONFIG)) && (
+
+ )}
+ {JSON.parse(siteConfig('NOBELIUM_MENU_SEARCH_BUTTON', null, CONFIG)) && (
+
+ )}
+
+
)
}
diff --git a/themes/nobelium/config.js b/themes/nobelium/config.js
index 0c4a9c1ebf0..905a40e14f0 100644
--- a/themes/nobelium/config.js
+++ b/themes/nobelium/config.js
@@ -1,5 +1,4 @@
const CONFIG = {
-
NOBELIUM_NAV_NOTION_ICON: true, // 是否读取Notion图标作为站点头像 ; 否则默认显示黑色SVG方块
// 特殊菜单
@@ -11,7 +10,8 @@ const CONFIG = {
NOBELIUM_MENU_TAG: true, // 显示标签
NOBELIUM_MENU_ARCHIVE: false, // 显示归档
NOBELIUM_MENU_SEARCH: true, // 显示搜索
- NOBELIUM_MENU_RSS: false // 显示订阅
+ NOBELIUM_MENU_RSS: false, // 显示订阅
+ NOBELIUM_AUTO_COLLAPSE_NAV_BAR: true // 页头导航栏动画
}
export default CONFIG