nobelium nav config

This commit is contained in:
tangly1024.com
2023-02-10 15:26:36 +08:00
parent a01aca8b84
commit c1bb225b5b
2 changed files with 21 additions and 12 deletions

View File

@@ -2,8 +2,10 @@ import { useEffect, useRef } from 'react'
import Link from 'next/link'
import BLOG from '@/blog.config'
import { useGlobal } from '@/lib/global'
import CONFIG_NOBELIUM from '../config_nobelium'
const Nav = ({ navBarTitle, fullWidth }) => {
const Nav = props => {
const { navBarTitle, fullWidth } = props
const useSticky = !BLOG.autoCollapsedNavBar
const navRef = useRef(null)
const sentinalRef = useRef([])
@@ -83,25 +85,26 @@ const Nav = ({ navBarTitle, fullWidth }) => {
</p>
)}
</div>
<NavBar />
<NavBar {...props}/>
</div>
</>;
</>
}
const NavBar = (props) => {
const NavBar = props => {
const { customNav } = props
const { locale } = useGlobal()
let links = [
{ id: 2, name: locale.NAV.RSS, to: '/feed', show: true },
{ icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: true },
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: true },
{ icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: false },
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: true }
{ id: 2, name: locale.NAV.RSS, to: '/feed', show: CONFIG_NOBELIUM.MENU_RSS, target: '_blank' },
{ icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG_NOBELIUM.MENU_SEARCH },
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG_NOBELIUM.MENU_ARCHIVE },
{ icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_NOBELIUM.MENU_CATEGORY },
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_NOBELIUM.MENU_TAG }
]
if (customNav) {
links = links.concat(customNav)
}
console.log(links)
return (
<div className="flex-shrink-0">
<ul className="flex flex-row">
@@ -112,7 +115,7 @@ const NavBar = (props) => {
key={link.id}
className="block ml-4 text-black dark:text-gray-50 nav"
>
<Link href={link.to}>
<Link href={link.to} target={link.target}>
{link.name}
</Link>
</li>
@@ -120,7 +123,7 @@ const NavBar = (props) => {
)}
</ul>
</div>
);
)
}
export default Nav

View File

@@ -1,4 +1,10 @@
const CONFIG_NOBELIUM = {
TEST_CONFIG: 'TEST'
// 菜单配置
MENU_CATEGORY: false, // 显示分类
MENU_TAG: true, // 显示标签
MENU_ARCHIVE: false, // 显示归档
MENU_SEARCH: true, // 显示搜索
MENU_RSS: false // 显示订阅
}
export default CONFIG_NOBELIUM