移除冗余的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

@@ -9,19 +9,21 @@ export const NormalMenu = props => {
return null
}
const selected = (router.pathname === link.to) || (router.asPath === link.to)
const selected = router.pathname === link.href || router.asPath === link.href
return <Link
key={`${link.to}`}
title={link.to}
href={link.to}
className={'py-0.5 duration-500 justify-between text-gray-500 dark:text-gray-300 hover:text-black hover:underline cursor-pointer flex flex-nowrap items-center ' +
(selected ? 'text-black' : ' ')}>
<div className='my-auto items-center justify-center flex '>
<div className={ 'hover:text-black'}>{link.name}</div>
</div>
{link.slot}
</Link>
return (
<Link
key={`${link.slug}`}
title={link.name}
href={link.href}
className={
'py-0.5 duration-500 justify-between text-gray-500 dark:text-gray-300 hover:text-black hover:underline cursor-pointer flex flex-nowrap items-center ' +
(selected ? 'text-black' : ' ')
}>
<div className='my-auto items-center justify-center flex '>
<div className={'hover:text-black'}>{link.name}</div>
</div>
{link.slot}
</Link>
)
}