little fix

This commit is contained in:
tangly1024.com
2024-01-30 18:45:39 +08:00
parent 16455c04de
commit 69fbde8328
2 changed files with 5 additions and 3 deletions

View File

@@ -32,7 +32,7 @@ export default function CategoryBar(props) {
return <div id='category-bar' className={`flex flex-nowrap justify-between items-center h-12 mb-4 space-x-2 w-full lg:bg-white dark:lg:bg-[#1e1e1e]
${border ? 'lg:border lg:hover:border dark:lg:border-gray-800 hover:border-indigo-600 dark:hover:border-yellow-600 ' : ''} py-2 lg:px-2 rounded-xl transition-colors duration-200`}>
<div id='category-bar-items' ref={categoryBarItemsRef} className='max-w-4xl rounded-lg scroll-hidden flex justify-start flex-nowrap items-center overflow-x-scroll'>
<div id='category-bar-items' ref={categoryBarItemsRef} className='scroll-smooth max-w-4xl rounded-lg scroll-hidden flex justify-start flex-nowrap items-center overflow-x-scroll'>
<MenuItem href='/' name={locale.NAV.INDEX} />
{categoryOptions?.map((c, index) => <MenuItem key={index} href={`/category/${c.name}`} name={c.name} />)}
</div>

View File

@@ -20,6 +20,9 @@ export const MenuItem = ({ link }) => {
return null
}
// #号加标题 快速跳转到指定锚点
const url = link?.to && link?.to.length > 0 ? link.to : '#' + link?.title
return <>
{/* 菜单 */}
<div
@@ -36,8 +39,7 @@ export const MenuItem = ({ link }) => {
</div>
</>)
: (
// link?.to
<Link href={'#' + link?.title} className='dark:text-neutral-400 dark:hover:text-white font-bold w-full display-block'>
<Link href={url} className='dark:text-neutral-400 dark:hover:text-white font-bold w-full display-block'>
{link?.icon && <i className={`text-base ${link?.icon}`} />}{link?.title}
</Link>
)