NAV主题 导航优化

This commit is contained in:
tangly1024
2024-01-31 21:42:26 +08:00
parent 80a141140a
commit c0c18e3fbe
2 changed files with 12 additions and 10 deletions

View File

@@ -17,7 +17,7 @@ const Footer = ({ siteInfo }) => {
© {`${copyrightDate}`}
</div>
<div className='text-xs font-serif py-1'>Powered By <a href='https://github.com/tangly1024/NotionNext' className='underline text-gray-500 dark:text-gray-300'>NotionNext</a></div>
<div className='text-xs font-serif py-1'>Powered By <a href='https://github.com/tangly1024/NotionNext' className='underline text-gray-500 dark:text-gray-300'>NotionNext {siteConfig('VERSION')}</a></div>
{siteConfig('BEI_AN') && <><i className='fas fa-shield-alt' /> <a href='https://beian.miit.gov.cn/' className='mr-2'>{siteConfig('BEI_AN')}</a><br /></>}

View File

@@ -21,8 +21,8 @@ export const MenuItem = ({ link }) => {
}
// #号加标题 快速跳转到指定锚点
const url = link?.to && link?.to !=='#' ? link.to : ('#' + link.name)
console.log(link,url , '#' + link.name)
const isAnchor = link?.to === '#'
const url = isAnchor ? ('#' + link.name) : link.to
return <>
{/* 菜单 */}
@@ -33,7 +33,7 @@ export const MenuItem = ({ link }) => {
{link?.subMenus
? (<>
<span 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}
<i className={`text-base ${link?.icon ? link?.icon : (isAnchor ? 'fas fa-hashtag' : '')} mr-1`} />{link?.title}
</span>
<div className='inline-flex items-center select-none pointer-events-none '>
<i className={`${isOpen ? '-rotate-90' : ''} text-xs dark:text-neutral-500 text-gray-300 hover:text-black dark:hover:text-white-400 px-2 fas fa-chevron-left transition-all duration-200`}></i>
@@ -41,23 +41,25 @@ export const MenuItem = ({ link }) => {
</>)
: (
<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}
<i className={`text-base ${link?.icon ? link?.icon : (isAnchor ? 'fas fa-hashtag' : '')} mr-1`} />{link?.title}
</Link>
)
}
</div>
{/* 菜单按钮 */}
{/* 菜单按钮 */}
{link?.subMenus && (
<Collapse isOpen={isOpen} key='collapse'>
{
link?.subMenus?.map((sLink, index) => {
// #号加标题 快速跳转到指定锚点
const sUrl = sLink?.to && sLink?.to.length !=='#' ? sLink.to : ('#' + sLink.name)
return <div key={index} className='nav-submenu'>
// #号加标题 快速跳转到指定锚点
const sIsAnchor = sLink?.to === '#'
const sUrl = sIsAnchor ? sLink.to : ('#' + sLink.name)
return <div key={index} className='nav-submenu'>
<Link href={sUrl}>
<span className='dark:text-neutral-400 text-gray-500 hover:text-black dark:hover:text-white text-xs font-bold'><i className={`text-xs mr-1 ${sLink?.icon ? sLink?.icon : 'fas fa-hashtag'}`} />{sLink.title}</span>
<span className='dark:text-neutral-400 text-gray-500 hover:text-black dark:hover:text-white text-xs font-bold'>
<i className={`text-xs mr-1 ${sLink?.icon ? sLink?.icon : (sIsAnchor ? 'fas fa-hashtag' : '')}`} />{sLink.title}</span>
</Link>
</div>
})