diff --git a/themes/fukasawa/components/MenuItemCollapse.js b/themes/fukasawa/components/MenuItemCollapse.js index 2d36242c..eb00850f 100644 --- a/themes/fukasawa/components/MenuItemCollapse.js +++ b/themes/fukasawa/components/MenuItemCollapse.js @@ -21,7 +21,7 @@ export const MenuItemCollapse = props => { return null } - const selected = router.pathname === link.to || router.asPath === link.to + const selected = router.pathname === link.href || router.asPath === link.href const toggleShow = () => { changeShow(!show) @@ -43,7 +43,7 @@ export const MenuItemCollapse = props => { onClick={toggleShow}> {!hasSubMenu && (
@@ -79,7 +79,7 @@ export const MenuItemCollapse = props => { className='whitespace-nowrap dark:text-gray-200 not:last-child:border-b-0 border-b dark:border-gray-800 py-2 px-14 cursor-pointer hover:bg-gray-100 font-extralight dark:bg-black text-left justify-start text-gray-600 bg-gray-50 dark:hover:bg-gray-900 tracking-widest transition-all duration-200'> - +
{ className='relative py-1 duration-500 justify-between text-gray-500 dark:text-gray-300 hover:text-black hover:underline cursor-pointer flex flex-nowrap items-center '> {!hasSubMenu && (
@@ -47,7 +47,7 @@ export const MenuItemDrop = ({ link }) => { return (
  • {sLink.icon && ( diff --git a/themes/fukasawa/components/MenuItemNormal.js b/themes/fukasawa/components/MenuItemNormal.js index 5910babb..a4ccf59d 100644 --- a/themes/fukasawa/components/MenuItemNormal.js +++ b/themes/fukasawa/components/MenuItemNormal.js @@ -4,21 +4,23 @@ import { useRouter } from 'next/router' export const MenuItemNormal = props => { const { link } = props const router = useRouter() - const selected = (router.pathname === link.to) || (router.asPath === link.to) + const selected = router.pathname === link.href || router.asPath === link.href if (!link || !link.show) { return null } - return - -
    -
    {link.name}
    -
    - {link.slot} - + return ( + +
    +
    {link.name}
    +
    + {link.slot} + ) } diff --git a/themes/fukasawa/components/MenuList.js b/themes/fukasawa/components/MenuList.js index 6b5be406..33e7695b 100644 --- a/themes/fukasawa/components/MenuList.js +++ b/themes/fukasawa/components/MenuList.js @@ -1,19 +1,39 @@ +import { siteConfig } from '@/lib/config' import { useGlobal } from '@/lib/global' import CONFIG from '../config' -import { siteConfig } from '@/lib/config' -import { MenuItemDrop } from './MenuItemDrop' import { MenuItemCollapse } from './MenuItemCollapse' - -export const MenuList = (props) => { +import { MenuItemDrop } from './MenuItemDrop' +/** + * ่œๅ•ๅˆ—่กจ + * @param {*} props + * @returns + */ +export const MenuList = props => { const { customNav, customMenu } = props const { locale } = useGlobal() let links = [ - { name: locale.NAV.INDEX, to: '/' || '/', show: true }, - { name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('FUKASAWA_MENU_CATEGORY', null, CONFIG) }, - { name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('FUKASAWA_MENU_TAG', null, CONFIG) }, - { name: locale.NAV.ARCHIVE, to: '/archive', show: siteConfig('FUKASAWA_MENU_ARCHIVE', null, CONFIG) }, - { name: locale.NAV.SEARCH, to: '/search', show: siteConfig('FUKASAWA_MENU_SEARCH', null, CONFIG) } + { name: locale.NAV.INDEX, href: '/' || '/', show: true }, + { + name: locale.COMMON.CATEGORY, + href: '/category', + show: siteConfig('FUKASAWA_MENU_CATEGORY', null, CONFIG) + }, + { + name: locale.COMMON.TAGS, + href: '/tag', + show: siteConfig('FUKASAWA_MENU_TAG', null, CONFIG) + }, + { + name: locale.NAV.ARCHIVE, + href: '/archive', + show: siteConfig('FUKASAWA_MENU_ARCHIVE', null, CONFIG) + }, + { + name: locale.NAV.SEARCH, + href: '/search', + show: siteConfig('FUKASAWA_MENU_SEARCH', null, CONFIG) + } ] if (customNav) { @@ -29,14 +49,22 @@ export const MenuList = (props) => { return null } - return (<> - - {links?.map((link, index) => )} - - - {links?.map((link, index) => )} - + return ( + <> + + {links?.map((link, index) => ( + + ))} + + + {links?.map((link, index) => ( + + ))} + - ) }