gitbook微调菜单

This commit is contained in:
tangly1024.com
2024-09-25 17:41:25 +08:00
parent 1821db79a0
commit bc5a6b8949
4 changed files with 41 additions and 41 deletions

View File

@@ -65,8 +65,8 @@ export default function Header(props) {
return (
<div id='top-nav' className={'fixed top-0 w-full z-20 ' + className}>
{/* PC端菜单 */}
<div className='px-5 flex justify-center border-b dark:border-black items-center w-full h-16 glassmorphism bg-white dark:bg-hexo-black-gray'>
<div className='max-w-screen-4xl w-full flex gap-x-3 justify-between items-center'>
<div className='flex justify-center border-b dark:border-black items-center w-full h-16 bg-white dark:bg-hexo-black-gray'>
<div className='px-5 max-w-screen-4xl w-full flex gap-x-3 justify-between items-center'>
{/* 左侧*/}
<div className='flex'>
<LogoBar {...props} />

View File

@@ -14,7 +14,7 @@ export default function LogoBar(props) {
<div id='logo-wrapper' className='w-full flex items-center mr-2'>
<Link
href={`/${siteConfig('GITBOOK_INDEX_PAGE', '', CONFIG)}`}
className='flex text-md font-bold md:text-xl dark:text-gray-200'>
className='flex text-lg font-bold md:text-2xl dark:text-gray-200'>
<LazyImage
src={siteInfo?.icon}
width={24}

View File

@@ -13,27 +13,9 @@ export const MenuItemDrop = ({ link }) => {
const selected = router.pathname === link.href || router.asPath === link.href
return (
<li
className='cursor-pointer list-none items-center flex mx-2'
className='cursor-pointer list-none items-center flex mx-2 font-semibold'
onMouseOver={() => changeShow(true)}
onMouseOut={() => changeShow(false)}>
{hasSubMenu && (
<div
className={
'px-2 h-full whitespace-nowrap duration-300 text-sm justify-between dark:text-gray-300 cursor-pointer flex flex-nowrap items-center ' +
(selected
? 'bg-green-600 text-white hover:text-white'
: 'hover:text-green-600')
}>
<div>
{link?.icon && <i className={link?.icon} />} {link?.name}
{hasSubMenu && (
<i
className={`px-2 fas fa-chevron-down duration-500 transition-all ${show ? ' rotate-180' : ''}`}></i>
)}
</div>
</div>
)}
{!hasSubMenu && (
<div
className={
@@ -48,25 +30,43 @@ export const MenuItemDrop = ({ link }) => {
</div>
)}
{/* 子菜单 */}
{/* 包含子菜单 */}
{hasSubMenu && (
<ul
className={`${show ? 'visible opacity-100 top-12 ' : 'invisible opacity-0 top-10 '} border-gray-100 bg-white dark:bg-black dark:border-gray-800 transition-all duration-300 z-20 absolute block drop-shadow-lg `}>
{link?.subMenus?.map((sLink, index) => {
return (
<li
key={index}
className='not:last-child:border-b-0 border-b text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-900 tracking-widest transition-all duration-200 dark:border-gray-800 py-3 pr-6 pl-3'>
<Link href={sLink.href} target={link?.target}>
<span className='text-xs font-extralight'>
{link?.icon && <i className={sLink?.icon}> &nbsp; </i>}
{sLink.title}
</span>
</Link>
</li>
)
})}
</ul>
<>
<div
className={
'px-2 h-full whitespace-nowrap duration-300 text-sm justify-between dark:text-gray-300 cursor-pointer flex flex-nowrap items-center ' +
(selected
? 'bg-green-600 text-white hover:text-white'
: 'hover:text-green-600')
}>
<div>
{link?.icon && <i className={link?.icon} />} {link?.name}
{hasSubMenu && (
<i
className={`px-2 fas fa-chevron-down duration-500 transition-all ${show ? ' rotate-180' : ''}`}></i>
)}
</div>
</div>
{/* 下拉菜单内容 */}
<ul
className={`${show ? 'visible opacity-100 top-12 ' : 'invisible opacity-0 top-10 '} border-gray-100 bg-white dark:bg-black dark:border-gray-800 transition-all duration-300 z-20 absolute block drop-shadow-lg `}>
{link?.subMenus?.map((sLink, index) => {
return (
<li
key={index}
className='not:last-child:border-b-0 border-b text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-900 tracking-widest transition-all duration-200 dark:border-gray-800 py-3 pr-6 pl-3'>
<Link href={sLink.href} target={link?.target}>
<span className='text-xs'>
{link?.icon && <i className={sLink?.icon}> &nbsp; </i>}
{sLink.title}
</span>
</Link>
</li>
)
})}
</ul>
</>
)}
</li>
)

View File

@@ -149,7 +149,7 @@ const LayoutBase = props => {
<div className={'hidden md:block relative z-10 '}>
<div className='w-80 pt-14 pb-4 sticky top-0 h-screen flex justify-between flex-col'>
{/* 导航 */}
<div className='overflow-y-scroll scroll-hidden pt-10'>
<div className='overflow-y-scroll scroll-hidden pt-10 pl-5'>
{/* 嵌入 */}
{slotLeft}