UI: Fix sticky position for TOC and Sidebar

This commit is contained in:
SonMooSans
2023-07-26 17:44:07 +08:00
parent 4350505d92
commit d91de398ae
3 changed files with 8 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"next-docs-ui": patch
---
Fix sticky position for TOC and Sidebar
@@ -21,7 +21,7 @@ export function Sidebar({ items }: { items: TreeNode[] }) {
<aside
className={clsx(
"nd-flex nd-flex-col nd-gap-2 nd-fixed nd-inset-0 nd-overflow-auto",
"md:nd-sticky md:nd-top-12 md:nd-py-16 md:nd-max-h-[calc(100vh-3rem)]",
"md:nd-sticky md:nd-top-14 md:nd-py-16 md:nd-max-h-[calc(100vh-3.5rem)]",
"max-md:nd-pt-20 max-md:nd-pb-4 max-md:nd-px-8 max-md:nd-bg-background/50 max-md:nd-backdrop-blur-xl max-md:nd-z-40"
)}
>
+2 -2
View File
@@ -19,8 +19,8 @@ export function DocsPage({
<Breadcrumb tree={tree} />
{children}
</article>
<div className="nd-relative nd-flex nd-flex-col nd-gap-3 nd-py-16 max-xl:nd-hidden">
<div className="nd-sticky nd-top-28 nd-flex nd-flex-col nd-gap-1 nd-overflow-auto nd-max-h-[calc(100vh-4rem-3rem)]">
<div className="nd-relative max-xl:nd-hidden">
<div className="nd-sticky nd-top-14 nd-py-16 nd-flex nd-flex-col nd-gap-1 nd-overflow-auto nd-max-h-[calc(100vh-3.5rem)]">
{toc.length > 0 && (
<h3 className="nd-font-semibold nd-mb-2">
On this page