mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
@@ -151,13 +151,12 @@ function AsideLeft(props) {
|
||||
<DarkModeButton />
|
||||
</section>
|
||||
|
||||
<section className='sticky top-0 pt-12'>
|
||||
<section className='sticky top-0 pt-12 flex flex-col max-h-screen '>
|
||||
<Catalog toc={post?.toc} />
|
||||
<div className='flex justify-center'>
|
||||
<div>{slot}</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -54,35 +54,32 @@ const Catalog = ({ toc }) => {
|
||||
|
||||
// 目录自动滚动
|
||||
const tRef = useRef(null)
|
||||
|
||||
// 无目录就直接返回空
|
||||
if (!toc || toc?.length < 1) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
return <div id='catalog'>
|
||||
return <div id='catalog' className='flex-1 flex-col flex overflow-hidden'>
|
||||
<div className='w-full dark:text-gray-300 mb-2'><i className='mr-1 fas fa-stream' />{locale.COMMON.TABLE_OF_CONTENTS}</div>
|
||||
<div className='h-96'>
|
||||
<nav ref={tRef} className='h-full overflow-y-auto overscroll-none scroll-hidden text-black'>
|
||||
{toc.map((tocItem) => {
|
||||
const id = uuidToId(tocItem.id)
|
||||
return (
|
||||
<a
|
||||
key={id}
|
||||
href={`#${id}`}
|
||||
className={`notion-table-of-contents-item duration-300 transform font-light dark:text-gray-300
|
||||
<nav ref={tRef} className='flex-1 overflow-auto overscroll-none scroll-hidden text-black mb-6'>
|
||||
{toc.map((tocItem) => {
|
||||
const id = uuidToId(tocItem.id)
|
||||
return (
|
||||
<a
|
||||
key={id}
|
||||
href={`#${id}`}
|
||||
className={`notion-table-of-contents-item duration-300 transform font-light dark:text-gray-300
|
||||
notion-table-of-contents-item-indent-level-${tocItem.indentLevel} `}
|
||||
>
|
||||
<span style={{ display: 'inline-block', marginLeft: tocItem.indentLevel * 16 }}
|
||||
className={`${activeSection === id && ' font-bold text-red-400 underline'}`}
|
||||
title={tocItem.text}
|
||||
>
|
||||
<span style={{ display: 'inline-block', marginLeft: tocItem.indentLevel * 16 }}
|
||||
className={`${activeSection === id && ' font-bold text-red-400 underline'}`}
|
||||
>
|
||||
{tocItem.text}
|
||||
</span>
|
||||
</a>
|
||||
)
|
||||
})}
|
||||
</nav>
|
||||
</div>
|
||||
{tocItem.text}
|
||||
</span>
|
||||
</a>
|
||||
)
|
||||
})}
|
||||
</nav>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user