Skip to content

Commit a1e4c1f

Browse files
committed
Unify colors and block scroll in navbar
1 parent a10a23e commit a1e4c1f

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

src/app/conf/2025/components/navbar.tsx

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ export function Navbar({ links, year }: NavbarProps): ReactElement {
2828
setMobileDrawerOpen(false)
2929
}, [pathname])
3030

31+
useEffect(() => {
32+
document.body.style.overflow = mobileDrawerOpen ? "hidden" : "auto"
33+
}, [mobileDrawerOpen])
34+
3135
return (
3236
<>
3337
<div
@@ -36,23 +40,18 @@ export function Navbar({ links, year }: NavbarProps): ReactElement {
3640
mobileDrawerOpen ? "static" : "absolute",
3741
)}
3842
/>
39-
<div
40-
// placeholder: the colors here on `before` must match the ones on Hero `before` strip
41-
className="absolute h-[calc(var(--navbar-h)+1px)] w-full bg-pri-base before:absolute before:top-0 before:h-[calc(var(--navbar-h)+1px)] before:w-full before:bg-white/30 dark:bg-pri-darker dark:before:bg-black/40"
42-
/>
43+
<NavbarPlaceholder className="bg-pri-base before:bg-white/30 dark:bg-pri-darker dark:before:bg-blk/40" />
4344
<header
4445
className={clsx(
45-
"gql-all-anchors-focusable top-0 z-10 w-full border-b border-black/60 font-mono text-neu-900 antialiased dark:border-white/80",
46-
mobileDrawerOpen
47-
? "fixed border-neu-900 dark:border-white"
48-
: "sticky",
46+
"gql-all-anchors-focusable sticky top-0 z-10 w-full border-b border-blk/60 font-mono text-neu-900 antialiased dark:border-white/80",
47+
mobileDrawerOpen && "!border-neu-900 dark:!border-white",
4948
)}
5049
>
5150
<BackdropBlur />
5251
<div className="flex h-[var(--navbar-h)] items-center justify-between gap-5 px-4 lg:px-10">
5352
<GraphQLConfLogoLink year={year} />
5453

55-
<div className="mr-auto flex h-full flex-col justify-center whitespace-pre border-x border-black/60 px-4 typography-menu dark:border-white/80 max-xl:hidden">
54+
<div className="mr-auto flex h-full flex-col justify-center whitespace-pre border-x border-blk/60 px-4 typography-menu dark:border-white/80 max-xl:hidden">
5655
<p className="flex items-center gap-2 text-sm">
5756
<time dateTime="2025-09-08">September 08</time>
5857
<span>-</span>
@@ -65,8 +64,9 @@ export function Navbar({ links, year }: NavbarProps): ReactElement {
6564

6665
{mobileDrawerOpen && (
6766
<div
67+
// menu overlay
6868
onClick={handleDrawerClick}
69-
className="fixed inset-0 top-[calc(var(--navbar-h)+1px)] z-10 bg-neu-0/40 backdrop-blur-[6.4px]"
69+
className="fixed inset-0 top-[calc(var(--navbar-h)+1px)] z-10 bg-white/40 backdrop-blur-[6.4px] dark:bg-blk/30"
7070
/>
7171
)}
7272

@@ -131,3 +131,19 @@ function BackdropBlur() {
131131
/>
132132
)
133133
}
134+
135+
export function NavbarPlaceholder({
136+
className,
137+
...rest
138+
}: React.HTMLAttributes<HTMLDivElement>) {
139+
return (
140+
<div
141+
// placeholder: the colors here on `before` must match the ones on Hero `before` strip
142+
className={clsx(
143+
"absolute h-[calc(var(--navbar-h)+1px)] w-full before:absolute before:top-0 before:h-[calc(var(--navbar-h)+1px)] before:w-full",
144+
className,
145+
)}
146+
{...rest}
147+
/>
148+
)
149+
}

0 commit comments

Comments
 (0)