@@ -32,26 +32,33 @@ export function Navbar({ links, year }: NavbarProps): ReactElement {
32
32
setMobileDrawerOpen ( false )
33
33
} , [ pathname ] )
34
34
35
+ const navbarHeight = "70px"
36
+
35
37
return (
36
38
< >
37
39
< div
38
40
/* pink background "prelude" */ className = { clsx (
39
- "top-0 h-[70px] w-full scale-y-105 bg-pri-base dark:bg-pri-darker" ,
41
+ "top-0 w-full scale-y-105 bg-pri-base dark:bg-pri-darker" ,
40
42
mobileDrawerOpen ? "static" : "absolute" ,
41
43
) }
44
+ style = { {
45
+ height : navbarHeight ,
46
+ } }
42
47
/>
43
48
< header
44
49
// todo: not white, but ALWAYS contrasting color, either white or black depending on background
45
50
className = { clsx (
46
- "top-0 z-10 w-full border-b border-white/70 bg-white/20 font-mono text-white antialiased" ,
51
+ "top-0 z-10 w-full bg-white/20 font-mono text-white antialiased" ,
47
52
mobileDrawerOpen ? "fixed" : "sticky" ,
48
53
) }
54
+ style = {
55
+ {
56
+ "--navbar-h" : navbarHeight ,
57
+ } as { }
58
+ }
49
59
>
50
- < div
51
- /* navbar backdrop */ className = "absolute inset-0 -z-10 backdrop-blur-[6.4px]"
52
- />
53
- { /* todo: better backdrop */ }
54
- < div className = "container flex h-[70px] items-center justify-between gap-5" >
60
+ < BackdropBlur />
61
+ < div className = "container flex h-[var(--navbar-h)] items-center justify-between gap-5" >
55
62
< div className = "flex items-center gap-2 text-xl/none uppercase" >
56
63
< NextLink href = "/" >
57
64
< GraphQLLogo className = "h-6" />
@@ -62,13 +69,13 @@ export function Navbar({ links, year }: NavbarProps): ReactElement {
62
69
{ mobileDrawerOpen && (
63
70
< div
64
71
onClick = { handleDrawerClick }
65
- className = "fixed inset-0 top-[71px ] z-10 bg-neu-0/40 backdrop-blur-[6.4px]"
72
+ className = "fixed inset-0 top-[calc(var(--navbar-h)+1px) ] z-10 bg-neu-0/40 backdrop-blur-[6.4px]"
66
73
/>
67
74
) }
68
75
69
76
< nav
70
77
className = { clsx (
71
- "inset-0 z-20 flex gap-7 typography-menu max-lg:fixed max-lg:mt-[71px ] max-lg:flex-col max-md:min-w-[50%] sm:max-lg:p-4 lg:items-end" ,
78
+ "inset-0 z-20 flex gap-7 typography-menu max-lg:fixed max-lg:mt-[calc(var(--navbar-h)+1px) ] max-lg:flex-col max-md:min-w-[50%] sm:max-lg:p-4 lg:items-end" ,
72
79
mobileDrawerOpen
73
80
? "translate-x-0 text-neu-900"
74
81
: "text-white max-lg:translate-x-full" ,
@@ -132,3 +139,29 @@ function GraphQLLogo(props: React.SVGProps<SVGSVGElement>) {
132
139
</ svg >
133
140
)
134
141
}
142
+
143
+ function BackdropBlur ( ) {
144
+ const mask = "linear-gradient(to bottom, #000 0% 50%, transparent 50% 100%)"
145
+ const edgeMask =
146
+ "linear-gradient(to bottom, black 0, black 1.1px, transparent 1.1px)"
147
+ return (
148
+ < >
149
+ < div
150
+ // note: we can't use the background trick to reduce flickering, because we have many section
151
+ // background colors and big images, so we'd have to change the --bg var with javascript
152
+ className = "pointer-events-none absolute inset-0 -z-10 h-[200%] backdrop-blur-[6.4px]"
153
+ style = { {
154
+ maskImage : mask ,
155
+ WebkitMaskImage : mask ,
156
+ } }
157
+ />
158
+ < div
159
+ className = "pointer-events-none absolute inset-0 -z-10 h-full translate-y-full bg-white/50 backdrop-blur-sm backdrop-brightness-200 backdrop-grayscale-[50%]"
160
+ style = { {
161
+ maskImage : edgeMask ,
162
+ WebkitMaskImage : edgeMask ,
163
+ } }
164
+ />
165
+ </ >
166
+ )
167
+ }
0 commit comments