移除冗余的slug转换函数

This commit is contained in:
tangly1024.com
2024-05-08 15:47:36 +08:00
parent fd3bc28216
commit 65eff434ec
41 changed files with 1076 additions and 1046 deletions

View File

@@ -1,18 +1,30 @@
import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
import CONFIG from '../config'
import { siteConfig } from '@/lib/config'
import { MenuItemCollapse } from './MenuItemCollapse'
export const MenuBarMobile = (props) => {
export const MenuBarMobile = props => {
const { customMenu, customNav } = props
const { locale } = useGlobal()
let links = [
// { name: locale.NAV.INDEX, to: '/' || '/', show: true },
{ name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('GITBOOK_MENU_CATEGORY', null, CONFIG) },
{ name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('GITBOOK_BOOK_MENU_TAG', null, CONFIG) },
{ name: locale.NAV.ARCHIVE, to: '/archive', show: siteConfig('GITBOOK_MENU_ARCHIVE', null, CONFIG) }
// { name: locale.NAV.SEARCH, to: '/search', show: siteConfig('MENU_SEARCH', null, CONFIG) }
// { name: locale.NAV.INDEX, href: '/' || '/', show: true },
{
name: locale.COMMON.CATEGORY,
href: '/category',
show: siteConfig('GITBOOK_MENU_CATEGORY', null, CONFIG)
},
{
name: locale.COMMON.TAGS,
href: '/tag',
show: siteConfig('GITBOOK_BOOK_MENU_TAG', null, CONFIG)
},
{
name: locale.NAV.ARCHIVE,
href: '/archive',
show: siteConfig('GITBOOK_MENU_ARCHIVE', null, CONFIG)
}
// { name: locale.NAV.SEARCH, href: '/search', show: siteConfig('MENU_SEARCH', null, CONFIG) }
]
if (customNav) {
@@ -30,7 +42,13 @@ export const MenuBarMobile = (props) => {
return (
<nav id='nav' className=' text-md'>
{links?.map((link, index) => <MenuItemCollapse onHeightChange={props.onHeightChange} key={index} link={link}/>)}
{links?.map((link, index) => (
<MenuItemCollapse
onHeightChange={props.onHeightChange}
key={index}
link={link}
/>
))}
</nav>
)
}