Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions app/(docs)/docs/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ export default function ComponentLayout({
children: React.ReactNode;
}>) {
return (
<div className="relative max-w-7xl mx-auto">
<div className="max-lg:px-4">
<div className="flex lg:gap-20 items-start">
{/* Sidebar */}
<div className="hidden lg:block w-60 flex-shrink-0 sticky top-28 self-start">
<SideNav />
</div>
{children}
</div>
<div className="mx-auto max-w-7xl">
{/* Sidebar — fixed to the viewport, left-aligned with the max-w-7xl (80rem)
centered container. On screens narrower than 80rem, left is 0. */}
<div className="fixed top-28 hidden h-[calc(100vh-7rem)] w-60 lg:left-[max(0px,calc((100vw-80rem)/2))] lg:block">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

top-28 (7rem) is coupled to the TopNav's rendered height — verify no gap or overlap.

The TopNav has a variable-height promotional banner + h-16 nav bar + 2px border. If the banner text wraps (e.g., on a screen just past the lg breakpoint), the total height could exceed 7rem, causing the sidebar to tuck under the nav. Conversely, if the banner is shorter than expected, there's a visible gap.

Since you've verified locally, this is likely fine, but it's worth testing at viewport widths near 1024px where the sidebar first appears and the banner is most likely to wrap.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/`(docs)/docs/layout.tsx at line 17, The fixed sidebar in layout.tsx uses
a hardcoded "top-28" value which can mismatch the actual TopNav height; replace
the hardcoded top with a dynamic value by exposing the TopNav height as a CSS
variable or measured value and using that for the sidebar top. Specifically,
have the TopNav component set --topnav-height (or expose its clientHeight via a
ref/useEffect) and update the sidebar div currently using "top-28" to use top:
var(--topnav-height) (or inline style from the measured value) so the sidebar
always aligns without gap/overlap; then test around the lg breakpoint where the
promo banner wraps.

<SideNav />
</div>

{/* Content area — pl-80 reserves space for the fixed sidebar (w-60) + gap (20).
No independent centering: the parent max-w-7xl is the single source of truth. */}
<div className="flex w-full items-start max-lg:px-4 lg:gap-20 lg:pl-80">
{children}
</div>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions components/SideNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export default function SideNav({ setIsOpen }: SideNavProps) {
const pathname = usePathname();

return (
<div className="sidebar-scroll border-r-2 z-10 overflow-y-scroll h-full max-h-[calc(100vh-6rem)] transition-transform transform md:translate-x-0 w-full bg-background flex flex-col justify-start md:justify-start py-8">
<div className="sidebar-scroll border-r-2 overflow-y-scroll overscroll-y-contain h-full w-full bg-background flex flex-col justify-start py-8">
<nav
className="flex flex-col items-start max-lg:px-6 space-y-4 z-99"
className="flex flex-col items-start max-lg:px-6 space-y-4"
aria-label="Main navigation"
>
{navConfig.sideNavItems.map((item) => (
Expand Down
2 changes: 1 addition & 1 deletion components/TableOfContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function TableOfContents({ toc }: TableOfContentsProps) {
}

return (
<div className="border p-4 rounded-sm max-h-60 overflow-y-auto sidebar-scroll">
<div className="border p-4 rounded-sm max-h-60 overflow-y-scroll overscroll-y-contain sidebar-scroll">
<h3 className="mb-3 border-b border-black pb-2">
On this Page
</h3>
Expand Down
2 changes: 1 addition & 1 deletion components/TopNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function TopNav() {
const { isDarkMode, toggleDarkMode } = useTheme();

return (
<nav className="sticky z-1 top-0 right-0 w-full border-b-2 bg-background">
<nav className="sticky z-50 top-0 right-0 w-full border-b-2 bg-background">
<div className="w-full bg-black text-white">
<div className="container max-w-6xl mx-auto px-4 py-2 flex justify-center space-x-4 items-center">
<Text className="text-sm lg:text-center">
Expand Down