fix: pin sidebar to viewport with sticky positioning
Sidebar was scrolling with page content. Fix by adding sticky top-0 h-screen. Widen collapsed width to 68px to prevent icon clipping.
This commit is contained in:
@@ -13,9 +13,9 @@ export default function DashboardShell({
|
|||||||
const { mobileOpen, closeMobile } = useSidebar()
|
const { mobileOpen, closeMobile } = useSidebar()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-1 min-h-0">
|
<div className="flex flex-1">
|
||||||
<Sidebar siteId={siteId} mobileOpen={mobileOpen} onMobileClose={closeMobile} />
|
<Sidebar siteId={siteId} mobileOpen={mobileOpen} onMobileClose={closeMobile} />
|
||||||
<main className="flex-1 min-w-0 overflow-auto pb-8">
|
<main className="flex-1 min-w-0 pb-8">
|
||||||
{children}
|
{children}
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -319,8 +319,8 @@ export default function Sidebar({
|
|||||||
|
|
||||||
{/* Desktop sidebar */}
|
{/* Desktop sidebar */}
|
||||||
<aside
|
<aside
|
||||||
className={`hidden lg:flex flex-col shrink-0 border-r border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 transition-[width] duration-200 ${
|
className={`hidden lg:flex flex-col shrink-0 sticky top-0 h-screen border-r border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 transition-[width] duration-200 overflow-hidden ${
|
||||||
collapsed ? 'w-16' : 'w-60'
|
collapsed ? 'w-[68px]' : 'w-60'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{sidebarContent(false)}
|
{sidebarContent(false)}
|
||||||
|
|||||||
Reference in New Issue
Block a user