Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
💄 Animate the how it works steps (#3037)
Luke Vella430bbdd94913
diff --git a/apps/landing/src/components/home/how-it-works/accent.ts b/apps/landing/src/components/home/how-it-works/accent.tsnew file mode 100644index 000000000..c21838b3d--- /dev/null+++ b/apps/landing/src/components/home/how-it-works/accent.ts@@ -0,0 +1,4 @@+// The accent gradient from the hero event card. The demos' primary actions+// reuse it so the walkthrough reads as the same product surface as the hero,+// rather than a flat indigo that appears nowhere else.+export const ACCENT = "bg-linear-to-r from-indigo-500 to-violet-500";diff --git a/apps/landing/src/components/home/how-it-works/create-step-demo.tsx b/apps/landing/src/components/home/how-it-works/create-step-demo.tsxindex eb8f9a796..620991d88 100644--- a/apps/landing/src/components/home/how-it-works/create-step-demo.tsx+++ b/apps/landing/src/components/home/how-it-works/create-step-demo.tsx@@ -1,61 +1,120 @@+"use client";+import { cn } from "@rallly/ui";+import * as m from "motion/react-m";import { DemoScreen } from "../hero-demo/demo-frame";+import { ACCENT } from "./accent";+import type { Playback } from "./motion";+import { EASE_OUT, EXIT, STAGGER } from "./motion";+import { PressButton } from "./press-button";// A textless mock of the poll creation form: title field and a month// calendar with a weekly cadence of selected days. Bars stand in for copy so// it doesn't compete with the section text. Sized to fit the 4:3 artboard on// the how it works section.+//+// On play the picked dates land one at a time in the order listed, then the+// submit button presses.const WEEKS = 4;const START_OFFSET = 2;-const SELECTED_COLUMN = 3;-export const CreateStepDemo = () => (- <DemoScreen className="space-y-2 p-4">- <div className="space-y-1.5">- <div className="h-1.5 w-8 rounded-full bg-gray-300" />- <div className="flex h-6 items-center rounded-md border border-gray-200 px-2">- <div className="h-1.5 w-24 rounded-full bg-gray-300" />- </div>- </div>- <div className="space-y-1.5">- <div className="flex items-center justify-between">- <div className="h-1.5 w-14 rounded-full bg-gray-300" />- <div className="h-1.5 w-10 rounded-full bg-gray-200" />+// Scattered rather than a single column: a weekly cadence reads as a+// recurring event, where the point here is someone picking whichever days+// happen to suit. Indices are cells in the WEEKS x 7 grid, listed in the+// order they get picked, which is deliberately not left to right.+const SELECTED = [10, 4, 17, 23, 12, 27];+const SUBMIT_DELAY = SELECTED.length * STAGGER + 0.12;++export const CreateStepDemo = ({ playback }: { playback: Playback }) => {+ const on = playback !== "idle";+ const instant = playback === "done";+ return (+ <DemoScreen className="space-y-2 p-4">+ <div className="space-y-1.5">+ <div className="h-1.5 w-8 rounded-full bg-gray-300" />+ <div className="flex h-6 items-center rounded-md border border-gray-200 px-2">+ <div className="h-1.5 w-24 rounded-full bg-gray-300" />+ </div></div>- <div className="grid grid-cols-7 gap-1">- {Array.from({ length: 7 }, (_, index) => (- <div- // biome-ignore lint/suspicious/noArrayIndexKey: weekday header cells are positional- key={index}- className="flex justify-center py-0.5"- >- <div className="h-1 w-2 rounded-full bg-gray-200" />- </div>- ))}- {Array.from({ length: WEEKS * 7 }, (_, index) => {- if (index < START_OFFSET) {+ <div className="space-y-1.5">+ <div className="flex items-center justify-between">+ <div className="h-1.5 w-14 rounded-full bg-gray-300" />+ <div className="h-1.5 w-10 rounded-full bg-gray-200" />+ </div>+ <div className="grid grid-cols-7 gap-1">+ {Array.from({ length: 7 }, (_, index) => (+ <div+ // biome-ignore lint/suspicious/noArrayIndexKey: weekday header cells are positional+ key={index}+ className="flex justify-center py-0.5"+ >+ <div className="h-1 w-2 rounded-full bg-gray-200" />+ </div>+ ))}+ {Array.from({ length: WEEKS * 7 }, (_, index) => {+ if (index < START_OFFSET) {+ return (+ <div+ // biome-ignore lint/suspicious/noArrayIndexKey: calendar cells are positional+ key={index}+ />+ );+ }+ const pickedAt = SELECTED.indexOf(index);+ if (pickedAt === -1) {+ return (+ <div+ // biome-ignore lint/suspicious/noArrayIndexKey: calendar cells are positional+ key={index}+ className="h-3.5 rounded bg-gray-100"+ />+ );+ }return (- <div+ <m.div// biome-ignore lint/suspicious/noArrayIndexKey: calendar cells are positionalkey={index}+ className="h-3.5 rounded bg-gray-100"+ initial={false}+ animate={+ on+ ? {+ backgroundColor: "#d1d5db",+ scale: instant ? 1 : [0.88, 1],+ }+ : { backgroundColor: "#f3f4f6", scale: 1 }+ }+ transition={+ instant+ ? { duration: 0 }+ : on+ ? {+ backgroundColor: {+ duration: 0.22,+ ease: EASE_OUT,+ delay: pickedAt * STAGGER,+ },+ scale: {+ type: "spring",+ duration: 0.44,+ bounce: 0.42,+ delay: pickedAt * STAGGER,+ },+ }+ : EXIT+ }/>);- }- return (- <div- // biome-ignore lint/suspicious/noArrayIndexKey: calendar cells are positional- key={index}- className={cn(- "h-3.5 rounded",- index % 7 === SELECTED_COLUMN ? "bg-gray-300" : "bg-gray-100",- )}- />- );- })}+ })}+ </div>+ </div>+ <div className="flex justify-end border-gray-200/60 border-t pt-2">+ <PressButton+ playback={playback}+ delay={SUBMIT_DELAY}+ className={cn("h-7 w-14 rounded-md", ACCENT)}+ /></div>- </div>- <div className="flex justify-end border-gray-200/60 border-t pt-2">- <div className="h-7 w-14 rounded-md bg-indigo-600/90" />- </div>- </DemoScreen>-);+ </DemoScreen>+ );+};diff --git a/apps/landing/src/components/home/how-it-works/decide-step-demo.tsx b/apps/landing/src/components/home/how-it-works/decide-step-demo.tsxindex 9b92ec140..2797151e3 100644--- a/apps/landing/src/components/home/how-it-works/decide-step-demo.tsx+++ b/apps/landing/src/components/home/how-it-works/decide-step-demo.tsx@@ -1,11 +1,20 @@+"use client";+import { cn } from "@rallly/ui";import { VoteIcon } from "@rallly/ui/vote-icon";+import * as m from "motion/react-m";import { DemoScreen } from "../hero-demo/demo-frame";+import { ACCENT } from "./accent";+import type { Playback } from "./motion";+import { EASE_OUT, EXIT } from "./motion";// A textless mock of the results: one row per option with real vote icons,// the winner highlighted. Bars stand in for copy so it doesn't compete with// the section text. Sized to fit the 4:3 artboard on the how it works// section.+//+// On play the votes arrive a participant at a time, so each column drops in as+// one response, and the winning row lights up once they're all in.const ROWS: { votes: ("yes" | "ifNeedBe" | "no")[]; winner: boolean }[] = [{ votes: ["yes", "yes", "yes", "yes"], winner: true },{ votes: ["yes", "no", "yes", "no"], winner: false },@@ -13,42 +22,101 @@ const ROWS: { votes: ("yes" | "ifNeedBe" | "no")[]; winner: boolean }[] = [{ votes: ["no", "yes", "ifNeedBe", "no"], winner: false },];-export const DecideStepDemo = () => (- <DemoScreen className="space-y-1.5 p-4">- {ROWS.map((row, rowIndex) => (- <div- // biome-ignore lint/suspicious/noArrayIndexKey: static wireframe rows- key={rowIndex}- className={cn(- "flex items-center justify-between gap-3 rounded-md border px-2.5 py-2",- row.winner ? "border-indigo-200 bg-indigo-50" : "border-gray-200",- )}- >- <div className="min-w-0 space-y-1.5">- <div- className={cn(- "h-1.5 w-16 rounded-full",- row.winner ? "bg-indigo-400" : "bg-gray-300",- )}- />- <div className="flex items-center gap-2">- <div className="h-1.5 w-10 rounded-full bg-gray-200" />- {row.winner ? (- <div className="h-1.5 w-12 rounded-full bg-indigo-600" />- ) : null}- </div>- </div>- <div className="flex shrink-0 items-center gap-1">- {row.votes.map((vote, voteIndex) => (- <VoteIcon- // biome-ignore lint/suspicious/noArrayIndexKey: static wireframe votes- key={voteIndex}- type={vote}- className="size-3.5"+// Votes land per participant, so the column is the beat. Rows within a column+// are nudged apart a little so a response reads as arriving rather than+// stamping four cells at once.+const VOTER_STAGGER = 0.09;+const ROW_STAGGER = 0.02;+const WINNER_DELAY = ROWS[0].votes.length * VOTER_STAGGER + 0.12;++export const DecideStepDemo = ({ playback }: { playback: Playback }) => {+ const on = playback !== "idle";+ const instant = playback === "done";+ return (+ <DemoScreen className="space-y-1.5 p-4">+ {ROWS.map((row, rowIndex) => (+ <m.div+ // biome-ignore lint/suspicious/noArrayIndexKey: static wireframe rows+ key={rowIndex}+ className={cn(+ "flex items-center justify-between gap-3 rounded-md border px-2.5 py-2",+ row.winner ? "border-indigo-200" : "border-gray-200",+ )}+ initial={false}+ animate={{+ backgroundColor:+ on && row.winner ? "rgb(238 242 255)" : "rgba(255,255,255,0)",+ }}+ transition={+ instant+ ? { duration: 0 }+ : on+ ? { duration: 0.34, ease: EASE_OUT, delay: WINNER_DELAY }+ : EXIT+ }+ >+ <div className="min-w-0 space-y-1.5">+ <div+ className={cn(+ "h-1.5 w-16 rounded-full",+ row.winner ? "bg-indigo-400" : "bg-gray-300",+ )}/>- ))}- </div>- </div>- ))}- </DemoScreen>-);+ <div className="flex items-center gap-2">+ <div className="h-1.5 w-10 rounded-full bg-gray-200" />+ {row.winner ? (+ <m.div+ className={cn("h-1.5 w-12 rounded-full", ACCENT)}+ initial={false}+ animate={{ opacity: on ? 1 : 0, scaleX: on ? 1 : 0.4 }}+ style={{ originX: 0 }}+ transition={+ instant+ ? { duration: 0 }+ : on+ ? {+ type: "spring",+ duration: 0.5,+ bounce: 0.24,+ delay: WINNER_DELAY + 0.08,+ }+ : EXIT+ }+ />+ ) : null}+ </div>+ </div>+ <div className="flex shrink-0 items-center gap-1">+ {row.votes.map((vote, voteIndex) => (+ <m.div+ // biome-ignore lint/suspicious/noArrayIndexKey: static wireframe votes+ key={voteIndex}+ initial={false}+ animate={+ on+ ? { opacity: 1, scale: 1, y: 0 }+ : { opacity: 0, scale: 0.82, y: -3 }+ }+ transition={+ instant+ ? { duration: 0 }+ : on+ ? {+ type: "spring",+ duration: 0.46,+ bounce: 0.38,+ delay:+ voteIndex * VOTER_STAGGER + rowIndex * ROW_STAGGER,+ }+ : EXIT+ }+ >+ <VoteIcon type={vote} className="size-3.5" />+ </m.div>+ ))}+ </div>+ </m.div>+ ))}+ </DemoScreen>+ );+};diff --git a/apps/landing/src/components/home/how-it-works/how-it-works.tsx b/apps/landing/src/components/home/how-it-works/how-it-works.tsxindex e945c8237..2cc7b3bfb 100644--- a/apps/landing/src/components/home/how-it-works/how-it-works.tsx+++ b/apps/landing/src/components/home/how-it-works/how-it-works.tsx@@ -8,16 +8,19 @@ import {SectionTitle,} from "@/components/section";import { getTranslation } from "@/i18n/server";-import { CreateStepDemo } from "./create-step-demo";-import { DecideStepDemo } from "./decide-step-demo";-import { ShareStepDemo } from "./share-step-demo";+import type { StepKey } from "./step-stage";+import { StepCue, StepStage } from "./step-stage";// The meeting poll walkthrough, shared by the home page and the SEO landing// pages. Owns its copy, unlike the rest of the landing components, so every// page renders the same three steps.export const HowItWorks = async ({ locale }: { locale: string }) => {const { t } = await getTranslation<"home">(locale, "home");- const steps = [+ const steps: {+ key: StepKey;+ title: React.ReactNode;+ description: React.ReactNode;+ }[] = [{key: "create",title: (@@ -36,7 +39,6 @@ export const HowItWorks = async ({ locale }: { locale: string }) => {defaults="Pick a few times that could work. Add a title and you're done. No account needed."/>),- visual: <CreateStepDemo />,},{key: "share",@@ -56,7 +58,6 @@ export const HowItWorks = async ({ locale }: { locale: string }) => {defaults="Send it over email, Slack, or WhatsApp. Participants don't need to sign up."/>),- visual: <ShareStepDemo />,},{key: "decide",@@ -76,7 +77,6 @@ export const HowItWorks = async ({ locale }: { locale: string }) => {defaults="Everyone marks the times that work for them, and the best option shows at a glance."/>),- visual: <DecideStepDemo />,},];@@ -115,38 +115,39 @@ export const HowItWorks = async ({ locale }: { locale: string }) => {<SectionContent>{/* Below lg the three steps stay side by side and scroll horizontally,bleeding past the page gutters so the next card peeks in. */}- <dl className="-mx-4 grid snap-x snap-mandatory scroll-px-4 grid-cols-[repeat(3,min(75vw,20rem))] grid-rows-[auto_auto] gap-x-4 gap-y-1 overflow-x-auto px-4 sm:-mx-6 sm:scroll-px-6 sm:px-6 lg:mx-0 lg:grid-cols-3 lg:overflow-x-visible lg:px-0">- {steps.map((step, index) => (- <div- key={step.key}- className="row-span-2 grid snap-start grid-rows-subgrid rounded-2xl border bg-white p-1"- >- <div className="space-y-4 rounded-xl border bg-gray-100 p-4">- <div className="font-mono text-gray-400 text-xs uppercase tracking-wide">- <Trans- t={t}- ns="home"- i18nKey="howItWorksStepLabel"- defaults="Step {number}"- values={{ number: `0${index + 1}` }}+ <StepCue>+ <dl className="-mx-4 grid snap-x snap-mandatory scroll-px-4 grid-cols-[repeat(3,min(75vw,20rem))] grid-rows-[auto_auto] gap-x-4 gap-y-1 overflow-x-auto px-4 sm:-mx-6 sm:scroll-px-6 sm:px-6 lg:mx-0 lg:grid-cols-3 lg:overflow-x-visible lg:px-0">+ {steps.map((step, index) => (+ <div+ key={step.key}+ className="row-span-2 grid snap-start grid-rows-subgrid rounded-2xl border bg-white p-1"+ >+ <div className="space-y-4 rounded-xl border bg-gray-100 p-4">+ <div className="font-mono text-gray-400 text-xs uppercase tracking-wide">+ <Trans+ t={t}+ ns="home"+ i18nKey="howItWorksStepLabel"+ defaults="Step {number}"+ values={{ number: `0${index + 1}` }}+ />+ </div>+ <StepStage+ step={step.key}+ index={index}+ className="flex h-64 items-center justify-center"/></div>- <div- aria-hidden="true"- className="flex h-64 items-center justify-center"- >- <div className="w-full max-w-64">{step.visual}</div>+ <div className="p-3">+ <dt className="font-medium text-gray-900">{step.title}</dt>+ <dd className="mt-2 text-pretty text-base/6 text-gray-500 sm:text-sm/5">+ {step.description}+ </dd></div></div>- <div className="p-3">- <dt className="font-medium text-gray-900">{step.title}</dt>- <dd className="mt-2 text-pretty text-base/6 text-gray-500 sm:text-sm/5">- {step.description}- </dd>- </div>- </div>- ))}- </dl>+ ))}+ </dl>+ </StepCue></SectionContent></Section>);diff --git a/apps/landing/src/components/home/how-it-works/motion.ts b/apps/landing/src/components/home/how-it-works/motion.tsnew file mode 100644index 000000000..18f987914--- /dev/null+++ b/apps/landing/src/components/home/how-it-works/motion.ts@@ -0,0 +1,31 @@+// Shared motion vocabulary for the how it works demos, so the three steps+// move with one cadence instead of each inventing its own.++// Strong ease-out. The built-in curves are too soft to read as deliberate at+// these short durations.+export const EASE_OUT = [0.23, 1, 0.32, 1] as const;++// Stagger between sibling beats: one date, one participant's votes. Kept+// short so a four beat sequence still resolves in well under a second.+export const STAGGER = 0.06;++// Leaving is not a performance: everything drops back at once, faster than it+// arrived, so moving the pointer away feels like an undo rather than a rewind.+export const EXIT = { duration: 0.18, ease: EASE_OUT } as const;++// A press is two beats, not one curve: the dip is a quick duration ease, the+// release settles on a spring so the button rebounds instead of interpolating+// back. Motion only supports two keyframes on a spring, so these are applied+// as separate transitions rather than one keyframe array.+export const PRESS_DOWN = { duration: 0.09, ease: EASE_OUT } as const;+export const PRESS_UP = {+ type: "spring",+ duration: 0.44,+ bounce: 0.42,+} as const;++// How a demo should render. "idle" is the resting state, "play" runs the timed+// sequence, and "done" jumps straight to the finished values with no delays or+// movement, which is what reduced motion wants: the information without the+// journey to it.+export type Playback = "idle" | "play" | "done";diff --git a/apps/landing/src/components/home/how-it-works/press-button.tsx b/apps/landing/src/components/home/how-it-works/press-button.tsxnew file mode 100644index 000000000..eb1aaf384--- /dev/null+++ b/apps/landing/src/components/home/how-it-works/press-button.tsx@@ -0,0 +1,58 @@+"use client";++import * as m from "motion/react-m";+import * as React from "react";+import type { Playback } from "./motion";+import { EXIT, PRESS_DOWN, PRESS_UP } from "./motion";++// The primary button in a demo, pressed on cue. The dip and the release are+// separate beats so the button rebounds off a spring instead of interpolating+// symmetrically back, which is what makes a press read as a press.+export const PressButton = ({+ playback,+ delay,+ className,+}: {+ playback: Playback;+ delay: number;+ className?: string;+}) => {+ const [down, setDown] = React.useState(false);++ React.useEffect(() => {+ // "done" never presses: a press is movement, and it has already happened.+ if (playback !== "play") {+ setDown(false);+ return;+ }+ const press = setTimeout(() => setDown(true), delay * 1000);+ const release = setTimeout(+ () => setDown(false),+ delay * 1000 + PRESS_DOWN.duration * 1000 + 60,+ );+ return () => {+ clearTimeout(press);+ clearTimeout(release);+ };+ }, [playback, delay]);++ return (+ <m.div+ className={className}+ initial={false}+ // Guarded on playback rather than down alone: switching reduced motion on+ // mid press would otherwise render the dip for a frame before the effect+ // clears it, which is the movement reduced motion is meant to avoid.+ animate={{ scale: playback === "play" && down ? 0.93 : 1 }}+ transition={+ playback === "done"+ ? { duration: 0 }+ : playback === "play"+ ? down+ ? PRESS_DOWN+ : PRESS_UP+ : EXIT+ }+ />+ );+};diff --git a/apps/landing/src/components/home/how-it-works/share-step-demo.tsx b/apps/landing/src/components/home/how-it-works/share-step-demo.tsxindex 536f0a4e0..76388bc95 100644--- a/apps/landing/src/components/home/how-it-works/share-step-demo.tsx+++ b/apps/landing/src/components/home/how-it-works/share-step-demo.tsx@@ -1,56 +1,129 @@+"use client";+import { cn } from "@rallly/ui";import { MailIcon, MessageCircleIcon, SendIcon } from "lucide-react";+import * as m from "motion/react-m";import { DemoScreen } from "../hero-demo/demo-frame";+import { ACCENT } from "./accent";+import type { Playback } from "./motion";+import { EASE_OUT, EXIT } from "./motion";+import { PressButton } from "./press-button";// A textless mock of the invite step: a link field with a copy button, ways// to send it, and the group it goes out to. Bars stand in for copy so it// doesn't compete with the section text. Fills the 4:3 frame on the how it// works section.+//+// On play a pointer travels to the copy button, presses it, and the link field+// flips to a confirmation. The pointer is drawn rather than implied so the+// button dip reads as a click.const CHANNELS = [{ key: "email", icon: MailIcon, width: "w-20" },{ key: "chat", icon: MessageCircleIcon, width: "w-14" },{ key: "direct", icon: SendIcon, width: "w-24" },];-export const ShareStepDemo = () => (- <DemoScreen className="space-y-2 p-4">- <div className="space-y-1.5">- <div className="h-1.5 w-12 rounded-full bg-gray-300" />- <div className="flex items-center gap-2">- <div className="flex h-7 min-w-0 flex-1 items-center gap-1.5 rounded-md border border-gray-200 bg-gray-50 px-2">- <div className="h-1.5 w-28 rounded-full bg-gray-300" />- </div>- <div className="h-7 w-14 shrink-0 rounded-md bg-indigo-600/90" />- </div>- </div>- <div className="space-y-1.5">- {CHANNELS.map((channel) => (- <div- key={channel.key}- className="flex items-center gap-2 rounded-md border border-gray-200 px-2 py-1.5"- >- <div className="flex size-5 shrink-0 items-center justify-center rounded bg-gray-100">- <channel.icon className="size-3 text-gray-400" />+const PRESS_AT = 0.42;+const COPIED_AT = PRESS_AT + 0.1;++// Copying recolors the url in place rather than swapping it for a shorter+// confirmation, so the field keeps the same block at the same width and the+// accent is what signals the copy.+const SWAP = { duration: 0.2, ease: EASE_OUT } as const;++export const ShareStepDemo = ({ playback }: { playback: Playback }) => {+ const on = playback !== "idle";+ const instant = playback === "done";+ return (+ <DemoScreen className="space-y-2 p-4">+ <div className="space-y-1.5">+ <div className="h-1.5 w-12 rounded-full bg-gray-300" />+ <div className="flex items-center gap-2">+ <div className="flex h-7 min-w-0 flex-1 items-center rounded-md border border-gray-200 bg-gray-50 px-2">+ {/* The accent fades over the resting bar rather than replacing its+ class, so the recolor transitions instead of snapping. */}+ <div className="relative h-1.5 w-28 shrink-0 overflow-hidden rounded-full bg-gray-300">+ <m.div+ className={cn("absolute inset-0", ACCENT)}+ initial={false}+ animate={{ opacity: on ? 1 : 0 }}+ transition={+ instant+ ? { duration: 0 }+ : { ...SWAP, delay: on ? COPIED_AT : 0 }+ }+ />+ </div>+ </div>+ <div className="relative shrink-0">+ <PressButton+ playback={playback}+ delay={PRESS_AT}+ className={cn("h-7 w-14 rounded-md", ACCENT)}+ />+ <m.div+ className="pointer-events-none absolute top-4 left-6"+ initial={false}+ animate={+ on ? { opacity: 1, x: 0, y: 0 } : { opacity: 0, x: 28, y: 24 }+ }+ transition={+ instant+ ? { duration: 0 }+ : on+ ? {+ x: { type: "spring", duration: 0.5, bounce: 0.2 },+ y: { type: "spring", duration: 0.5, bounce: 0.2 },+ opacity: { duration: 0.14, ease: EASE_OUT },+ }+ : { ...EXIT, opacity: { duration: 0.12 } }+ }+ >+ <CursorIcon />+ </m.div></div>- <div- className={cn("h-1.5 rounded-full bg-gray-300", channel.width)}- /></div>- ))}- </div>- <div className="flex items-center gap-3 border-gray-200/60 border-t pt-3">- <div className="flex shrink-0 -space-x-1.5">- {[0, 1, 2, 3].map((participant) => (+ </div>+ <div className="space-y-1.5">+ {CHANNELS.map((channel) => (<div- key={participant}- className="size-6 rounded-full bg-gray-300 ring-2 ring-white"- />+ key={channel.key}+ className="flex items-center gap-2 rounded-md border border-gray-200 px-2 py-1.5"+ >+ <div className="flex size-5 shrink-0 items-center justify-center rounded bg-gray-100">+ <channel.icon className="size-3 text-gray-400" />+ </div>+ <div+ className={cn("h-1.5 rounded-full bg-gray-300", channel.width)}+ />+ </div>))}</div>- <div className="min-w-0 flex-1 space-y-1.5">- <div className="h-1.5 max-w-32 rounded-full bg-gray-200" />- <div className="h-1.5 max-w-20 rounded-full bg-gray-200" />+ <div className="flex items-center gap-3 border-gray-200/60 border-t pt-3">+ <div className="flex shrink-0 -space-x-1.5">+ {[0, 1, 2, 3].map((participant) => (+ <div+ key={participant}+ className="size-6 rounded-full bg-gray-300 ring-2 ring-white"+ />+ ))}+ </div>+ <div className="min-w-0 flex-1 space-y-1.5">+ <div className="h-1.5 max-w-32 rounded-full bg-gray-200" />+ <div className="h-1.5 max-w-20 rounded-full bg-gray-200" />+ </div></div>- </div>- </DemoScreen>+ </DemoScreen>+ );+};++const CursorIcon = () => (+ <svg+ aria-hidden="true"+ viewBox="0 0 12 12"+ className="size-4 fill-gray-900 stroke-white drop-shadow-sm"+ strokeWidth="1"+ >+ <path d="M1 1 L1 10 L3.5 7.6 L5.3 11 L7 10.1 L5.2 6.9 L8.6 6.7 Z" />+ </svg>);diff --git a/apps/landing/src/components/home/how-it-works/step-stage.tsx b/apps/landing/src/components/home/how-it-works/step-stage.tsxnew file mode 100644index 000000000..31f20230a--- /dev/null+++ b/apps/landing/src/components/home/how-it-works/step-stage.tsx@@ -0,0 +1,89 @@+"use client";++import { useInView, useReducedMotion } from "motion/react";+import * as React from "react";+import { CreateStepDemo } from "./create-step-demo";+import { DecideStepDemo } from "./decide-step-demo";+import type { Playback } from "./motion";+import { ShareStepDemo } from "./share-step-demo";++// The demo is picked here rather than passed in: a server component can't hand+// a client component a render prop, and the wireframes are decorative, so+// selecting on a key keeps the section a server component.+const DEMOS = {+ create: CreateStepDemo,+ share: ShareStepDemo,+ decide: DecideStepDemo,+};++export type StepKey = keyof typeof DEMOS;++// Each step waits its turn so the three read as one walkthrough rather than+// three things happening at once. Roughly the length of a step's own sequence,+// so the next one starts as the previous settles.+const STEP_STAGGER = 900;++// The cue comes from the first step rather than each step watching itself:+// below lg the later cards sit outside the viewport in a horizontal scroller,+// so self-observation would start their sequences whenever they were scrolled+// to, breaking the order.+const StepCueContext = React.createContext(false);++export const StepCue = ({+ children,+ className,+}: {+ children: React.ReactNode;+ className?: string;+}) => {+ const ref = React.useRef<HTMLDivElement>(null);+ // A bottom margin so the walkthrough starts as the cards come up rather than+ // the instant the first pixel appears. Deliberately no amount threshold: the+ // strip can be taller than the viewport, where a fraction like 0.4 would+ // never be reached and the section would never play.+ const started = useInView(ref, { once: true, margin: "0px 0px -15% 0px" });++ return (+ <div ref={ref} className={className}>+ <StepCueContext.Provider value={started}>+ {children}+ </StepCueContext.Provider>+ </div>+ );+};++export const StepStage = ({+ step,+ index,+ className,+}: {+ step: StepKey;+ index: number;+ className?: string;+}) => {+ const started = React.useContext(StepCueContext);+ const [play, setPlay] = React.useState(false);+ const reduceMotion = useReducedMotion();+ const Demo = DEMOS[step];+ // Reduced motion skips the sequence and shows the outcome, rather than+ // playing the same timed choreography with the movement left in.+ const playback: Playback = reduceMotion ? "done" : play ? "play" : "idle";++ React.useEffect(() => {+ if (!started) {+ return;+ }+ // Plays once and holds: the finished state says more than the empty one,+ // so there is nothing to gain from resetting it.+ const timer = setTimeout(() => setPlay(true), index * STEP_STAGGER);+ return () => clearTimeout(timer);+ }, [started, index]);++ return (+ <div aria-hidden="true" className={className}>+ <div className="w-full max-w-64">+ <Demo playback={playback} />+ </div>+ </div>+ );+};