Skip to content

Commit

Permalink
little fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tangly1024 committed Jan 30, 2024
1 parent 16455c0 commit 69fbde8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion themes/heo/components/CategoryBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
6 changes: 4 additions & 2 deletions themes/nav/components/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export const MenuItem = ({ link }) => {
return null
}

// #号加标题 快速跳转到指定锚点
const url = link?.to && link?.to.length > 0 ? link.to : '#' + link?.title

return <>
{/* 菜单 */}
<div
Expand All @@ -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>
)
Expand Down

0 comments on commit 69fbde8

Please sign in to comment.