Skip to content

Commit 7010ba7

Browse files
committed
some fixes
1 parent 246403c commit 7010ba7

3 files changed

Lines changed: 53 additions & 11 deletions

File tree

app/components/contributions.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ export async function Contributions({ login }: { login: string }) {
2121
return (
2222
<section className="section" data-reveal>
2323
<div className="flex flex-col gap-0 mb-4">
24-
<div className={s.sectionHead}>
25-
<p className="mb-0 flex items-baseline justify-between gap-4">
26-
Contributions
27-
</p>
24+
<div className="mb-0 flex items-baseline justify-between gap-4">
25+
<p className={s.sectionLabel}>Contributions</p>
2826
<a
2927
className={s.sectionAll}
3028
href={`https://github.com/${login}`}

app/components/nav.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ export function Nav() {
1616
const pathname = usePathname();
1717

1818
return (
19-
<nav
20-
aria-label="Main"
21-
className="sticky top-0 z-10 bg-background/80 backdrop-blur-md backdrop-saturate-150"
22-
>
19+
<nav aria-label="Main" className="sticky top-0 z-10">
20+
{/* the frosted panel, on its own layer so it can fade in on scroll while
21+
the links stay put — see .nav-surface in globals */}
22+
<span aria-hidden="true" className="nav-surface" />
2323
<div className="mx-auto flex w-full max-w-(--width-wide) gap-6 px-gutter py-[1.1rem]">
2424
{items.map((item) => {
2525
const active =

app/globals.css

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040
scroll-behavior: smooth;
4141
color-scheme: dark;
4242
-webkit-tap-highlight-color: transparent;
43+
/* `clip`, not `hidden`: hidden would make this a scroll container and
44+
break the sticky nav. clip pairs with a visible vertical axis without
45+
coercing it, so the page still scrolls down but can never scroll
46+
sideways — whatever overhangs. The hover cards are centred on their
47+
link and a link near the right edge pushes one past the edge. */
48+
overflow-x: clip;
4349
}
4450

4551
body {
@@ -51,10 +57,14 @@
5157
min-height: 100vh;
5258
-webkit-font-smoothing: antialiased;
5359
text-rendering: optimizeLegibility;
60+
/* Pools behind the page heading rather than sitting off the top edge —
61+
every route puts its title in the same place, so one gradient anchored
62+
to the top of the document lands behind all of them. The cursor glow
63+
adds to this where the pointer is, which is where it came from. */
5464
background-image: radial-gradient(
55-
60rem 30rem at 50% -12rem,
56-
--alpha(var(--color-accent) / 8%),
57-
transparent 70%
65+
38rem 20rem at 38% 5rem,
66+
--alpha(var(--color-accent) / 14%),
67+
transparent 72%
5868
);
5969
background-repeat: no-repeat;
6070
}
@@ -371,6 +381,40 @@ dialog[open]::backdrop {
371381
}
372382
}
373383

384+
/* The nav's frosted panel. Solid by default so that any browser without
385+
scroll-driven animations keeps today's behaviour — legible links over a
386+
backdrop — and only browsers that can do the fade get the transparent top.
387+
Its own layer rather than a background on <nav>, because opacity is the one
388+
property that fades a backdrop-filter cleanly. */
389+
.nav-surface {
390+
position: absolute;
391+
inset: 0;
392+
z-index: -1;
393+
background: --alpha(var(--color-background) / 80%);
394+
backdrop-filter: blur(12px) saturate(1.5);
395+
}
396+
397+
@media (prefers-reduced-motion: no-preference) {
398+
@supports (animation-timeline: scroll()) {
399+
.nav-surface {
400+
animation: nav-surface-in linear both;
401+
animation-timeline: scroll(root block);
402+
/* fully solid within the first few rem of scrolling, so it isn't
403+
still fading in halfway down the page */
404+
animation-range: 0 4rem;
405+
}
406+
}
407+
}
408+
409+
@keyframes nav-surface-in {
410+
from {
411+
opacity: 0;
412+
}
413+
to {
414+
opacity: 1;
415+
}
416+
}
417+
374418
/* Reading position, drawn straight from the scroll offset. No JS, no scroll
375419
listener — and in browsers without scroll-driven animations the bar simply
376420
stays at scaleX(0) and is never seen. */

0 commit comments

Comments
 (0)