mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-04 07:26:47 +00:00
slug 调整兼容已有主题
This commit is contained in:
@@ -29,7 +29,7 @@ export const MenuItemCollapse = props => {
|
||||
onClick={toggleShow}>
|
||||
{!hasSubMenu && (
|
||||
<Link
|
||||
href={link?.to}
|
||||
href={link?.href}
|
||||
target={link?.target}
|
||||
className='w-full my-auto items-center justify-between flex dark:text-gray-200 '>
|
||||
<div>
|
||||
@@ -65,7 +65,7 @@ export const MenuItemCollapse = props => {
|
||||
className='whitespace-nowrap dark:text-gray-200
|
||||
not:last-child:border-b-0 border-b dark:border-gray-800 py-2 px-14 cursor-pointer hover:bg-gray-100
|
||||
font-extralight dark:bg-black text-left justify-start text-gray-600 bg-gray-50 dark:hover:bg-gray-900 tracking-widest transition-all duration-200'>
|
||||
<Link href={sLink.to} target={link?.target}>
|
||||
<Link href={sLink.href} target={link?.target}>
|
||||
<div>
|
||||
{sLink.icon && (
|
||||
<div
|
||||
|
||||
@@ -12,7 +12,7 @@ export const MenuItemDrop = ({ link }) => {
|
||||
className='relative py-1.5 px-5 duration-300 text-base justify-between hover:bg-gray-700 hover:text-white hover:shadow-lg cursor-pointer font-light flex flex-nowrap items-center '>
|
||||
{!hasSubMenu && (
|
||||
<Link
|
||||
href={link?.to}
|
||||
href={link?.href}
|
||||
target={link?.target}
|
||||
className='w-full my-auto items-center justify-between flex '>
|
||||
<div>
|
||||
@@ -47,7 +47,7 @@ export const MenuItemDrop = ({ link }) => {
|
||||
return (
|
||||
<li key={sLink.id}>
|
||||
<Link
|
||||
href={sLink.to}
|
||||
href={sLink.href}
|
||||
target={link?.target}
|
||||
className='my-auto h-9 px-2 items-center justify-start flex 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 '>
|
||||
{sLink.icon && (
|
||||
|
||||
@@ -1,19 +1,48 @@
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import { MenuItemDrop } from './MenuItemDrop'
|
||||
import { MenuItemCollapse } from './MenuItemCollapse'
|
||||
import { MenuItemDrop } from './MenuItemDrop'
|
||||
|
||||
export const MenuList = (props) => {
|
||||
export const MenuList = props => {
|
||||
const { postCount, customNav, customMenu } = props
|
||||
const { locale } = useGlobal()
|
||||
const archiveSlot = <div className='bg-gray-300 dark:bg-gray-500 rounded-md text-gray-50 px-1 text-xs'>{postCount}</div>
|
||||
const archiveSlot = (
|
||||
<div className='bg-gray-300 dark:bg-gray-500 rounded-md text-gray-50 px-1 text-xs'>
|
||||
{postCount}
|
||||
</div>
|
||||
)
|
||||
|
||||
const defaultLinks = [
|
||||
{ id: 1, icon: 'fas fa-home', name: locale.NAV.INDEX, to: '/' || '/', show: true },
|
||||
{ id: 2, icon: 'fas fa-th', name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('NEXT_MENU_CATEGORY', null, CONFIG) },
|
||||
{ id: 3, icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('NEXT_MENU_TAG', null, CONFIG) },
|
||||
{ id: 4, icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', slot: archiveSlot, show: siteConfig('NEXT_MENU_ARCHIVE', null, CONFIG) }
|
||||
{
|
||||
id: 1,
|
||||
icon: 'fas fa-home',
|
||||
name: locale.NAV.INDEX,
|
||||
href: '/' || '/',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
icon: 'fas fa-th',
|
||||
name: locale.COMMON.CATEGORY,
|
||||
href: '/category',
|
||||
show: siteConfig('NEXT_MENU_CATEGORY', null, CONFIG)
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
icon: 'fas fa-tag',
|
||||
name: locale.COMMON.TAGS,
|
||||
href: '/tag',
|
||||
show: siteConfig('NEXT_MENU_TAG', null, CONFIG)
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
icon: 'fas fa-archive',
|
||||
name: locale.NAV.ARCHIVE,
|
||||
href: '/archive',
|
||||
slot: archiveSlot,
|
||||
show: siteConfig('NEXT_MENU_ARCHIVE', null, CONFIG)
|
||||
}
|
||||
]
|
||||
|
||||
let links = [].concat(defaultLinks)
|
||||
@@ -31,21 +60,38 @@ export const MenuList = (props) => {
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* 大屏模式菜单 */}
|
||||
<menu id='nav' data-aos="fade-down"
|
||||
data-aos-duration="500"
|
||||
data-aos-delay="400"
|
||||
data-aos-once="true"
|
||||
data-aos-anchor-placement="top-bottom"
|
||||
className='hidden md:block leading-8 text-gray-500 dark:text-gray-400 '>
|
||||
{links.map((link, index) => link && link.show && <MenuItemDrop key={index} link={link} />)}
|
||||
</menu>
|
||||
<>
|
||||
{/* 大屏模式菜单 */}
|
||||
<menu
|
||||
id='nav'
|
||||
data-aos='fade-down'
|
||||
data-aos-duration='500'
|
||||
data-aos-delay='400'
|
||||
data-aos-once='true'
|
||||
data-aos-anchor-placement='top-bottom'
|
||||
className='hidden md:block leading-8 text-gray-500 dark:text-gray-400 '>
|
||||
{links.map(
|
||||
(link, index) =>
|
||||
link && link.show && <MenuItemDrop key={index} link={link} />
|
||||
)}
|
||||
</menu>
|
||||
|
||||
{/* 移动端菜单 */}
|
||||
<menu id='nav-menu-mobile' className='block md:hidden my-auto justify-start bg-white'>
|
||||
{links?.map((link, index) => link && link.show && <MenuItemCollapse onHeightChange={props.onHeightChange} key={index} link={link} />)}
|
||||
</menu>
|
||||
</>
|
||||
{/* 移动端菜单 */}
|
||||
<menu
|
||||
id='nav-menu-mobile'
|
||||
className='block md:hidden my-auto justify-start bg-white'>
|
||||
{links?.map(
|
||||
(link, index) =>
|
||||
link &&
|
||||
link.show && (
|
||||
<MenuItemCollapse
|
||||
onHeightChange={props.onHeightChange}
|
||||
key={index}
|
||||
link={link}
|
||||
/>
|
||||
)
|
||||
)}
|
||||
</menu>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import Live2D from '@/components/Live2D'
|
||||
import Tabs from '@/components/Tabs'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import CONFIG from '../config'
|
||||
import Card from './Card'
|
||||
import InfoCard from './InfoCard'
|
||||
import Logo from './Logo'
|
||||
import { MenuList } from './MenuList'
|
||||
import SearchInput from './SearchInput'
|
||||
import Toc from './Toc'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import Tabs from '@/components/Tabs'
|
||||
import Logo from './Logo'
|
||||
import Card from './Card'
|
||||
import CONFIG from '../config'
|
||||
import Live2D from '@/components/Live2D'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 侧边平铺
|
||||
@@ -23,55 +23,68 @@ const SideAreaLeft = props => {
|
||||
const { post, slot, postCount } = props
|
||||
const { locale } = useGlobal()
|
||||
const showToc = post && post.toc && post.toc.length > 1
|
||||
return <aside id='left' className={(JSON.parse(siteConfig('LAYOUT_SIDEBAR_REVERSE')) ? 'ml-4' : 'mr-4') + ' hidden lg:block flex-col w-60 z-20 relative'}>
|
||||
|
||||
<section
|
||||
className='w-60'>
|
||||
{/* 菜单 */}
|
||||
<section className='shadow hidden lg:block mb-5 pb-4 bg-white dark:bg-hexo-black-gray hover:shadow-xl duration-200'>
|
||||
<Logo className='h-32' {...props} />
|
||||
<div className='pt-2 px-2 '>
|
||||
<MenuList allowCollapse={true} {...props} />
|
||||
</div>
|
||||
{siteConfig('NEXT_MENU_SEARCH', null, CONFIG) && <div className='px-2 pt-2 '>
|
||||
<SearchInput {...props} />
|
||||
</div>}
|
||||
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
<div className='sticky top-4 hidden lg:block'>
|
||||
<Card>
|
||||
<Tabs>
|
||||
{showToc && (
|
||||
<div key={locale.COMMON.TABLE_OF_CONTENTS} className='dark:text-gray-400 text-gray-600 bg-white dark:bg-hexo-black-gray duration-200'>
|
||||
<Toc toc={post.toc} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div key={locale.NAV.ABOUT} className='mb-5 bg-white dark:bg-hexo-black-gray duration-200 py-6'>
|
||||
<InfoCard {...props} />
|
||||
<>
|
||||
<div className='mt-2 text-center dark:text-gray-300 font-light text-xs'>
|
||||
<span className='px-1 '>
|
||||
<strong className='font-medium'>{postCount}</strong>{locale.COMMON.POSTS}</span>
|
||||
<span className='px-1 busuanzi_container_site_uv hidden'>
|
||||
| <strong className='pl-1 busuanzi_value_site_uv font-medium' />{locale.COMMON.VISITORS}</span>
|
||||
{/* <span className='px-1 busuanzi_container_site_pv hidden'>
|
||||
| <strong className='pl-1 busuanzi_value_site_pv font-medium'/>{locale.COMMON.VIEWS}</span> */}
|
||||
</div>
|
||||
</>
|
||||
</div>
|
||||
</Tabs>
|
||||
</Card>
|
||||
|
||||
<div className='flex justify-center'>
|
||||
{slot}
|
||||
<Live2D />
|
||||
return (
|
||||
<aside
|
||||
id='left'
|
||||
className={
|
||||
(JSON.parse(siteConfig('LAYOUT_SIDEBAR_REVERSE')) ? 'ml-4' : 'mr-4') +
|
||||
' hidden lg:block flex-col w-60 z-20 relative'
|
||||
}>
|
||||
<section className='w-60'>
|
||||
{/* 菜单 */}
|
||||
<section className='shadow hidden lg:block mb-5 pb-4 bg-white dark:bg-hexo-black-gray hover:shadow-xl duration-200'>
|
||||
<Logo className='min-h-32 ' {...props} />
|
||||
<div className='pt-2 px-2 '>
|
||||
<MenuList allowCollapse={true} {...props} />
|
||||
</div>
|
||||
{siteConfig('NEXT_MENU_SEARCH', null, CONFIG) && (
|
||||
<div className='px-2 pt-2 '>
|
||||
<SearchInput {...props} />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<div className='sticky top-4 hidden lg:block'>
|
||||
<Card>
|
||||
<Tabs>
|
||||
{showToc && (
|
||||
<div
|
||||
key={locale.COMMON.TABLE_OF_CONTENTS}
|
||||
className='dark:text-gray-400 text-gray-600 bg-white dark:bg-hexo-black-gray duration-200'>
|
||||
<Toc toc={post.toc} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div
|
||||
key={locale.NAV.ABOUT}
|
||||
className='mb-5 bg-white dark:bg-hexo-black-gray duration-200 py-6'>
|
||||
<InfoCard {...props} />
|
||||
<>
|
||||
<div className='mt-2 text-center dark:text-gray-300 font-light text-xs'>
|
||||
<span className='px-1 '>
|
||||
<strong className='font-medium'>{postCount}</strong>
|
||||
{locale.COMMON.POSTS}
|
||||
</span>
|
||||
<span className='px-1 busuanzi_container_site_uv hidden'>
|
||||
|{' '}
|
||||
<strong className='pl-1 busuanzi_value_site_uv font-medium' />
|
||||
{locale.COMMON.VISITORS}
|
||||
</span>
|
||||
{/* <span className='px-1 busuanzi_container_site_pv hidden'>
|
||||
| <strong className='pl-1 busuanzi_value_site_pv font-medium'/>{locale.COMMON.VIEWS}</span> */}
|
||||
</div>
|
||||
</>
|
||||
</div>
|
||||
</Tabs>
|
||||
</Card>
|
||||
|
||||
<div className='flex justify-center'>
|
||||
{slot}
|
||||
<Live2D />
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
)
|
||||
}
|
||||
export default SideAreaLeft
|
||||
|
||||
Reference in New Issue
Block a user