Skip to content

Commit e2e93c2

Browse files
committed
fix-build
1 parent cdcf7b5 commit e2e93c2

File tree

10 files changed

+45
-29
lines changed

10 files changed

+45
-29
lines changed

themes/fukasawa/components/MenuList.js

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ export const MenuList = (props) => {
2525
links = customMenu
2626
}
2727

28+
if (!links || links.length === 0) {
29+
return null
30+
}
31+
2832
return (<>
2933
<nav id='nav-pc' className='hidden md:block font-sans text-sm z-20'>
3034
{links?.map(link => <MenuItemDrop key={link.id} link={link} />)}

themes/hexo/components/MenuListSide.js

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ export const MenuListSide = (props) => {
2323
if (BLOG.CUSTOM_MENU) {
2424
links = customMenu
2525
}
26+
27+
if (!links || links.length === 0) {
28+
return null
29+
}
30+
2631
return (
2732
<nav>
2833
{/* {links.map(link => <MenuItemNormal key={link.id} link={link} />)} */}

themes/hexo/components/MenuListTop.js

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ export const MenuListTop = (props) => {
2525
links = customMenu
2626
}
2727

28+
if (!links || links.length === 0) {
29+
return null
30+
}
31+
2832
return (<>
2933
<nav id='nav-mobile' className='leading-8 justify-center font-light w-full flex'>
3034
{links?.map(link => link && link.show && <MenuItemDrop key={link.id} link={link} />)}

themes/matery/components/MenuListSide.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,15 @@ export const MenuListSide = (props) => {
2323
if (BLOG.CUSTOM_MENU) {
2424
links = customMenu
2525
}
26+
27+
if (!links || links.length === 0) {
28+
return null
29+
}
30+
2631
return (
2732
<nav>
2833
{/* {links.map(link => <MenuItemNormal key={link.id} link={link} />)} */}
29-
{links.map(link => <MenuItemCollapse key={link.id} link={link} />)}
34+
{links?.map(link => <MenuItemCollapse key={link.id} link={link} />)}
3035
</nav>
3136
)
3237
}

themes/matery/components/MenuListTop.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@ export const MenuListTop = (props) => {
2323
if (BLOG.CUSTOM_MENU) {
2424
links = customMenu
2525
}
26+
27+
if (!links || links.length === 0) {
28+
return null
29+
}
30+
2631
return (
2732
<nav id='nav' className='leading-8 flex justify-center font-light w-full'>
28-
{links.map(link => <MenuItemDrop key={link.id} link={link}/>)}
33+
{links?.map(link => <MenuItemDrop key={link.id} link={link}/>)}
2934
</nav>
3035
)
3136
}

themes/medium/components/MenuBarMobile.js

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ export const MenuBarMobile = (props) => {
2525
links = customMenu
2626
}
2727

28+
if (!links || links.length === 0) {
29+
return null
30+
}
31+
2832
return (
2933
<nav id='nav' className=' text-md'>
3034
{/* {links.map(link => <NormalMenu key={link.id} link={link}/>)} */}

themes/medium/components/TopNavBar.js

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ export default function TopNavBar(props) {
3737
links = customMenu
3838
}
3939

40+
if (!links || links.length === 0) {
41+
return null
42+
}
43+
4044
return (
4145
<div id='top-nav' className={'sticky top-0 lg:relative w-full z-40 ' + className}>
4246

themes/next/components/MenuList.js

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ export const MenuList = (props) => {
2727
links = customMenu
2828
}
2929

30+
if (!links || links.length === 0) {
31+
return null
32+
}
33+
3034
return (
3135
<>
3236
{/* 大屏模式菜单 */}

themes/nobelium/components/Nav.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,19 @@ const NavBar = props => {
9797
links = customMenu
9898
}
9999

100+
if (!links || links.length === 0) {
101+
return null
102+
}
103+
100104
return (
101105
<div className="flex-shrink-0">
102106
<ul className=" hidden md:flex flex-row">
103-
{links.map(link => <MenuItemDrop key={link.id} link={link} />)}
107+
{links?.map(link => <MenuItemDrop key={link.id} link={link} />)}
104108
</ul>
105109
<div className='md:hidden'><i onClick={toggleOpen} className='fas fa-bars cursor-pointer px-5 block md:hidden'></i>
106110
<Collapse collapseRef={collapseRef} isOpen={isOpen} type='vertical' className='fixed top-16 right-6'>
107111
<div className='dark:border-black bg-white dark:bg-black rounded border p-2 text-sm'>
108-
{links.map(link => <MenuItemCollapse key={link.id} link={link} onHeightChange={(param) => collapseRef.current?.updateCollapseHeight(param)}/>)}
112+
{links?.map(link => <MenuItemCollapse key={link.id} link={link} onHeightChange={(param) => collapseRef.current?.updateCollapseHeight(param)}/>)}
109113
</div>
110114
</Collapse>
111115
</div>

themes/simple/components/NavBar.js

+2-25
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import BLOG from '@/blog.config'
2-
import { useGlobal } from '@/lib/global'
31
import { useRouter } from 'next/router'
42
import { useState } from 'react'
5-
import CONFIG_SIMPLE from '../config_simple'
63
import { MenuList } from './MenuList'
74

85
/**
@@ -11,8 +8,6 @@ import { MenuList } from './MenuList'
118
* @returns
129
*/
1310
export const NavBar = (props) => {
14-
const { customNav, customMenu } = props
15-
const { locale } = useGlobal()
1611
const [showSearchInput, changeShowSearchInput] = useState(false)
1712
const router = useRouter()
1813

@@ -29,24 +24,6 @@ export const NavBar = (props) => {
2924
}
3025
}
3126

32-
let links = [
33-
{ icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG_SIMPLE.MENU_SEARCH },
34-
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG_SIMPLE.MENU_ARCHIVE },
35-
{ icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_SIMPLE.MENU_CATEGORY },
36-
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_SIMPLE.MENU_TAG }
37-
]
38-
39-
if (customNav) {
40-
links = links.concat(customNav)
41-
}
42-
43-
if (BLOG.CUSTOM_MENU) {
44-
links = customMenu
45-
}
46-
if (!links || links.length === 0) {
47-
return null
48-
}
49-
5027
return (
5128
<nav className="w-full bg-white md:pt-0 relative z-20 shadow border-t border-gray-100 dark:border-hexo-black-gray dark:bg-black">
5229
<div id="nav-bar-inner" className="h-12 mx-auto max-w-9/10 justify-between items-center text-sm md:text-md md:justify-start">
@@ -56,9 +33,9 @@ export const NavBar = (props) => {
5633
{!showSearchInput && (<MenuList {...props}/>)}
5734
</div>
5835

59-
<div className="absolute right-12 h-full text-center px-2 flex items-center text-blue-400">
36+
<div className="absolute right-12 h-full text-center px-2 flex items-center text-blue-400 cursor-pointer">
6037
{/* <!-- extra links --> */}
61-
<i className={showSearchInput ? 'fa-regular fa-circle-xmark' : 'fa-solid fa-magnifying-glass' + ' align-middle cursor-pointer'} onClick={toggleShowSearchInput}></i>
38+
<i className={showSearchInput ? 'fa-regular fa-circle-xmark' : 'fa-solid fa-magnifying-glass' + ' align-middle'} onClick={toggleShowSearchInput}></i>
6239
</div>
6340
</div>
6441
</nav>

0 commit comments

Comments
 (0)