Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

fix(homepage): tune the design-to-check scroll hand-off (RX-198)

Amruth Pillai5dc05da112bb
diff --git a/apps/web/src/features/homepage/check.tsx b/apps/web/src/features/homepage/check.tsx
index 8eeb147ae..42601b889 100644
--- a/apps/web/src/features/homepage/check.tsx
+++ b/apps/web/src/features/homepage/check.tsx
@@ -169,7 +169,8 @@ export function Check() {
aria-labelledby="check-title"
className="relative h-[245vh] min-[900px]:h-[295vh]"
>
- <div className="sticky top-0 h-svh overflow-clip [--chk:var(--sp)] [--dw:calc(clamp(0,(var(--sp)-.42)*20,1)*(1-clamp(0,(var(--sp)-.7)*20,1)))] [--lo:clamp(0,(var(--p)-.04)*10,1)] [--pw:min(62vw,40vh)] [--sp:clamp(0,(var(--p)-.06)/.8,1)] [--sv:clamp(0,var(--p)/.24,1)] min-[900px]:[--pw:min(28vw,58vh)]">
+ {/* The page and lens are already there as the scene rises, so the hand-off never opens on an empty half-screen. */}
+ <div className="sticky top-0 h-svh overflow-clip [--chk:var(--sp)] [--dw:calc(clamp(0,(var(--sp)-.42)*20,1)*(1-clamp(0,(var(--sp)-.7)*20,1)))] [--lo:clamp(.85,var(--p)*20,1)] [--pw:min(62vw,40vh)] [--sp:clamp(0,(var(--p)-.06)/.8,1)] [--sv:clamp(0,var(--p)/.24,1)] min-[900px]:[--pw:min(28vw,58vh)]">
<h2
id="check-title"
className="absolute start-(--gutter) top-[10vh] max-w-[90vw] text-[9vw] leading-[1.05] font-normal text-balance text-ink min-[900px]:top-[11vh] min-[900px]:max-w-[45vw] min-[900px]:text-[clamp(40px,4vw,72px)]"
@@ -220,7 +221,7 @@ export function Check() {
onPointerMove={moveLens}
onPointerLeave={releaseLens}
data-lens-page
- className="@container absolute end-[calc(50%-var(--pw)/2)] bottom-[3vh] aspect-[612/792] w-(--pw) [transform:rotate(1deg)] cursor-crosshair rounded-sm opacity-[clamp(0,var(--p)*20,1)] shadow-paper min-[900px]:end-[10vw] min-[900px]:top-[52%] min-[900px]:bottom-auto min-[900px]:[transform:translateY(-50%)_rotate(1deg)]"
+ className="@container absolute end-[calc(50%-var(--pw)/2)] bottom-[3vh] aspect-[612/792] w-(--pw) [transform:rotate(1deg)] cursor-crosshair rounded-sm opacity-[clamp(.85,var(--p)*20,1)] shadow-paper min-[900px]:end-[10vw] min-[900px]:top-[52%] min-[900px]:bottom-auto min-[900px]:[transform:translateY(-50%)_rotate(1deg)]"
>
<Sheet />
<div
diff --git a/apps/web/src/features/homepage/design.tsx b/apps/web/src/features/homepage/design.tsx
index 43d1c868d..481941e6d 100644
--- a/apps/web/src/features/homepage/design.tsx
+++ b/apps/web/src/features/homepage/design.tsx
@@ -68,7 +68,7 @@ export function Design() {
data-scene={SCENE.design}
data-pin
aria-labelledby="design-title"
- className="relative h-[320vh] min-[900px]:h-[360vh]"
+ className="relative h-[280vh] min-[900px]:h-[320vh]"
>
<div className="sticky top-0 h-svh overflow-clip [--dpt:52%] [--pw:min(66vw,42vh)] [--w1:clamp(0,(var(--p)-.1)/.1,1)] [--w2:clamp(0,(var(--p)-.26)/.1,1)] [--w3:clamp(0,(var(--p)-.42)/.1,1)] [--w4:clamp(0,(var(--p)-.58)/.1,1)] [--z:clamp(0,(var(--p)-.76)/.16,1)] min-[900px]:[--dpt:57%] min-[900px]:[--pw:min(24vw,44vh)]">
<Doodle
@@ -80,7 +80,7 @@ export function Design() {
<div
aria-hidden="true"
- className="absolute inset-x-0 top-[12vh] h-[1.05em] [transform:translateY(calc(var(--z)*-10vh))] text-[15vw] font-normal text-ink opacity-[calc(1-var(--z))] will-change-[transform,opacity] min-[900px]:top-[10vh] min-[900px]:text-[clamp(80px,10vw,180px)]"
+ className="absolute inset-x-0 top-[12vh] h-[1.05em] [transform:translateY(calc(var(--z)*-10vh))] text-[15vw] font-normal text-ink opacity-[calc(1-clamp(0,var(--z)*5,1))] will-change-[transform,opacity] min-[900px]:top-[10vh] min-[900px]:text-[clamp(80px,10vw,180px)]"
>
<span className="absolute inset-0 text-center font-display leading-none tracking-[-.03em] opacity-[calc(1-clamp(0,(var(--w1)-.35)*3.4,1))]">
{design}
@@ -108,38 +108,38 @@ export function Design() {
/>
</div>
- <div
- aria-hidden="true"
- className="absolute top-(--dpt) left-1/2 grid [transform:translate(-50%,calc(-50%-var(--z)*8vh))_scale(calc(1-var(--z)*(1-var(--smin,.5))))] grid-cols-[repeat(7,var(--pw))] gap-[calc(var(--pw)*.12)] opacity-(--z) will-change-[transform,opacity] [transition:transform_.35s_var(--ease)]"
- >
- {sheetCells.map((cell) => (
- <div
- key={cell.index}
- className={cn(
- "relative aspect-[612/792] [transform:translateY(calc((1-var(--z))*var(--rise)))] will-change-transform [transition:transform_.5s_var(--ease)]",
- !cell.template && "invisible",
- )}
- style={{ "--rise": `${cell.rise}px` } as CSSProperties}
- >
- {cell.template && (
- <>
- <img
- src={`/templates/thumb/${cell.template}.webp`}
- alt=""
- width={298}
- height={420}
- loading="lazy"
- decoding="async"
- draggable={false}
- className="absolute inset-0 size-full rounded-sm bg-paper object-contain shadow-paper dark:brightness-[.93]"
- />
- <span className={cn(pageLabel, "absolute start-0 top-[calc(100%+10px)]")}>
- {templates[cell.template].name}
- </span>
- </>
- )}
- </div>
- ))}
+ {/* The mask is on this screen-sized wrapper, not the scaling grid, so it stays over the headline bands. */}
+ <div aria-hidden="true" className="design-wall pointer-events-none absolute inset-0">
+ <div className="absolute top-(--dpt) left-1/2 grid [transform:translate(-50%,calc(-50%-var(--z)*8vh))_scale(calc(1-var(--z)*(1-var(--smin,.5))))] grid-cols-[repeat(7,var(--pw))] gap-[calc(var(--pw)*.12)] opacity-(--z) will-change-[transform,opacity] [transition:transform_.35s_var(--ease)]">
+ {sheetCells.map((cell) => (
+ <div
+ key={cell.index}
+ className={cn(
+ "relative aspect-[612/792] [transform:translateY(calc((1-var(--z))*var(--rise)))] will-change-transform [transition:transform_.5s_var(--ease)]",
+ !cell.template && "invisible",
+ )}
+ style={{ "--rise": `${cell.rise}px` } as CSSProperties}
+ >
+ {cell.template && (
+ <>
+ <img
+ src={`/templates/thumb/${cell.template}.webp`}
+ alt=""
+ width={298}
+ height={420}
+ loading="lazy"
+ decoding="async"
+ draggable={false}
+ className="absolute inset-0 size-full rounded-sm bg-paper object-contain shadow-paper dark:brightness-[.93]"
+ />
+ <span className={cn(pageLabel, "absolute start-0 top-[calc(100%+10px)]")}>
+ {templates[cell.template].name}
+ </span>
+ </>
+ )}
+ </div>
+ ))}
+ </div>
</div>
<div
@@ -207,7 +207,7 @@ export function Design() {
<SceneCaption
number="02"
title={design}
- className="absolute start-(--gutter) bottom-[clamp(20px,5vh,44px)] hidden max-w-[22em] opacity-[calc(1-var(--z)*2)] min-[1100px]:flex"
+ className="absolute start-(--gutter) bottom-[clamp(20px,5vh,44px)] hidden max-w-[22em] opacity-[calc(1-clamp(0,var(--z)*3,1))] min-[1100px]:flex"
>
{t`Pick from ${templateCount} templates, then set the type, color and spacing. The words stay put, so try as many looks as you like.`}
</SceneCaption>
@@ -216,7 +216,7 @@ export function Design() {
<h2
id="design-title"
aria-label={`${t`${templateCount} free resume templates.`} ${t`Make any of them yours.`}`}
- className="pointer-events-none absolute inset-x-(--gutter) top-[12vh] bottom-[8vh] [transform:translateY(calc((1-var(--z))*30px))] text-center text-[8vw] leading-none font-normal text-balance opacity-(--z) will-change-[transform,opacity] min-[900px]:bottom-[5vh] min-[900px]:text-[clamp(36px,4vw,72px)]"
+ className="pointer-events-none absolute inset-x-(--gutter) top-[10vh] bottom-[8vh] [transform:translateY(calc((1-var(--z))*30px))] text-center text-[8vw] leading-none font-normal text-balance opacity-[calc(clamp(0,(var(--z)-.18)/.1,1)*(1-clamp(0,(var(--out)-.6)/.06,1)))] will-change-[transform,opacity] min-[900px]:bottom-[5vh] min-[900px]:text-[clamp(36px,4vw,72px)]"
>
<Link to="/resume-templates" inert={!zoomed} className="flex h-full flex-col justify-between">
<span className="font-anybody pointer-events-auto font-light tracking-[-.02em] text-ink">
diff --git a/apps/web/src/features/homepage/landing.css b/apps/web/src/features/homepage/landing.css
index b5e827304..7c3f707ee 100644
--- a/apps/web/src/features/homepage/landing.css
+++ b/apps/web/src/features/homepage/landing.css
@@ -221,6 +221,15 @@
}
}
+/*
+ * The template wall fades into the page above and below its middle, clearing the bands where Design's closing headline
+ * sits. Once the wall reaches its resting size those bands are empty anyway, so this only softens the oversized frames
+ * on the way in and stops the words from sitting on thumbnails at low contrast.
+ */
+@utility design-wall {
+ mask-image: linear-gradient(to bottom, transparent 18.5%, #000 20%, #000 81%, transparent 88%);
+}
+
/* One of the hero's career fragments: it drifts from (--x, --y) to (--tx, --ty) as the page assembles (--e). */
@utility hero-fragment {
position: absolute;
diff --git a/apps/web/src/features/homepage/scroll.test.ts b/apps/web/src/features/homepage/scroll.test.ts
index 03c42bb05..8e59c92e2 100644
--- a/apps/web/src/features/homepage/scroll.test.ts
+++ b/apps/web/src/features/homepage/scroll.test.ts
@@ -1,5 +1,5 @@
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
-import { goToScene, sectionProgress, useLanding } from "./scroll";
+import { goToScene, sectionExitProgress, sectionProgress, useLanding } from "./scroll";
describe("section progress", () => {
it("measures a pinned scene by how far its sticky stage has travelled", () => {
@@ -16,6 +16,15 @@ describe("section progress", () => {
});
});
+describe("scene exit", () => {
+ it("runs from the section's bottom reaching the fold to its bottom passing the top", () => {
+ expect(sectionExitProgress(1000, 1000)).toBe(0);
+ expect(sectionExitProgress(500, 1000)).toBe(0.5);
+ expect(sectionExitProgress(0, 1000)).toBe(1);
+ expect(sectionExitProgress(-400, 1000)).toBe(1);
+ });
+});
+
describe("scene navigation", () => {
afterEach(() => vi.unstubAllGlobals());
it.each(["wheel", "touchmove", "PageDown", "ArrowDown", " ", "a"])(
diff --git a/apps/web/src/features/homepage/scroll.ts b/apps/web/src/features/homepage/scroll.ts
index 33df3928b..dbe533a8c 100644
--- a/apps/web/src/features/homepage/scroll.ts
+++ b/apps/web/src/features/homepage/scroll.ts
@@ -101,6 +101,15 @@ export function sectionProgress(top: number, height: number, viewportHeight: num
return clamp01((viewportHeight - top) / Math.max(1, Math.min(height, viewportHeight)));
}
+/**
+ * How far a section has scrolled out of the viewport, from 0 as its bottom reaches the bottom edge to 1 once its bottom
+ * passes the top edge. A pinned scene holds its last frame while it leaves, so Design uses this to hand its closing
+ * headline over to Check instead of letting the word hang over the next scene.
+ */
+export function sectionExitProgress(bottom: number, viewportHeight: number) {
+ return clamp01((viewportHeight - bottom) / Math.max(1, viewportHeight));
+}
+
const reducedMotionQuery = "(prefers-reduced-motion: reduce)";
export const prefersReducedMotion = () => window.matchMedia(reducedMotionQuery).matches;
@@ -214,6 +223,7 @@ export function useScrollScenes(root: RefObject<HTMLElement | null>) {
const sectionAt = (index: number) => sections.find((section) => section.dataset.scene === String(index));
// Rewriting an unchanged --p would still restyle the whole section, so only changes are written.
const writtenProgress = new WeakMap<HTMLElement, string>();
+ const writtenExit = new WeakMap<HTMLElement, string>();
// Where Check's lens comes to rest, as a share of its page: over the date line it flags.
let lensPark = { x: 60, y: 50 };
@@ -282,6 +292,13 @@ export function useScrollScenes(root: RefObject<HTMLElement | null>) {
if (rect.top < viewportHeight * 2 && rect.bottom > -viewportHeight) nearby.add(index);
const pinned = section.dataset.pin !== undefined;
progress[index] = reduced ? 1 : sectionProgress(rect.top, rect.height, viewportHeight, pinned);
+ if (pinned) {
+ const exit = sectionExitProgress(rect.bottom, viewportHeight).toFixed(3);
+ if (writtenExit.get(section) !== exit) {
+ section.style.setProperty("--out", exit);
+ writtenExit.set(section, exit);
+ }
+ }
if (rect.top <= viewportHeight / 2 && rect.bottom > viewportHeight / 2) activeScene = index;
}
warmScenes(sections, nearby, decodedScenes);