Page sections / Feature sections
Step Accordion with Grain Photo
Left: a three-line display headline with stacked rounded step cards. The active card is white with a hairline ring and a description, and inactive cards are gray with muted titles. Right: a rounded grainy photo with a floating white inbox list card overlaid at the bottom.
Rebuilt from cal.com in the Warm Paper Calendar style.
Looks exactly like cal.com: brings its fonts and colours, namespaced so your own theme stays untouched.
Restyled to your project: uses your shadcn colours, fonts and radius, so it matches the rest of your app. Layout, type sizes and motion stay as designed.
Usage
Props: headline, steps (title, desc, photo, inbox rows), interval (ms per step), footnote. Steps auto-advance with a progress tick and can be clicked to jump; the photo and inbox card swap with the active step.
components/accordion-steps-with-photo.tsx
"use client"; import { useLayoutEffect, useRef, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useEffect, useState } from "react"; type Step = { title: string; desc: string; photo: string; rows: { name: string; subject: string; preview: string; time: string; unread?: boolean }[] }; const defaultSteps: Step[] = [ { title: "Stop juggling calendars by hand", desc: "Five people, four cities, nine messages and still no meeting.", photo: "https://yoink-app.fly.dev/stock/people-1.jpg", rows: [ { name: "Mara Quinn", subject: "Re: Kickoff?", preview: "Tuesday at 2 works, sending a hold.", time: "11:03", unread: true }, { name: "Jonas Weber", subject: "Re: Kickoff?", preview: "Can we move it to the afternoon?", time: "09:52", unread: true }, { name: "Mara Quinn", subject: "Kickoff?", preview: "Do you have 45 minutes this week?", time: "09:14", unread: true }, { name: "Ines Alva", subject: "Roadmap notes", preview: "Summary from Monday is in the doc.", time: "Mon" }, { name: "Facilities", subject: "Lift service", preview: "The lift is out of order on Friday.", time: "Mon" } ] }, { title: "Share one link with your open hours", desc: "Your availability, always current, in a single URL.", photo: "https://yoink-app.fly.dev/stock/workspace-3.jpg", rows: [ { name: "You", subject: "Book time with me", preview: "Pick any slot that suits you.", time: "12:10" }, { name: "Mara Quinn", subject: "Re: Book time", preview: "Opening the link now.", time: "12:12", unread: true }, { name: "Jonas Weber", subject: "Re: Book time", preview: "Thanks, this is handy.", time: "12:20", unread: true }, { name: "Ines Alva", subject: "Roadmap notes", preview: "Summary from Monday is in the doc.", time: "Mon" }, { name: "Facilities", subject: "Lift service", preview: "The lift is out of order on Friday.", time: "Mon" } ] }, { title: "Let guests choose", desc: "They pick a slot and the invite lands on every calendar.", photo: "https://yoink-app.fly.dev/stock/people-2.jpg", rows: [ { name: "Calendar", subject: "Confirmed: Kickoff", preview: "Thursday 10:00, video call.", time: "13:01", unread: true }, { name: "Mara Quinn", subject: "Accepted", preview: "See you then.", time: "13:02" }, { name: "Jonas Weber", subject: "Accepted", preview: "Looking forward to it.", time: "13:04" }, { name: "Ines Alva", subject: "Roadmap notes", preview: "Summary from Monday is in the doc.", time: "Mon" }, { name: "Facilities", subject: "Lift service", preview: "The lift is out of order on Friday.", time: "Mon" } ] }, ]; export default function StepAccordionWithGrainPhoto({ headline = "Booking a meeting ate a whole week. Now it takes one link.", steps = defaultSteps, interval = 5000, footnote = "Northwind cuts scheduling time by a third across teams and saves thousands of hours each week." }: { headline?: string; steps?: Step[]; interval?: number; footnote?: string }) { const [active, setActive] = useState(0); const [tick, setTick] = useState(0); useEffect(() => { const t = setTimeout(() => setActive((a) => (a + 1) % steps.length), interval); return () => clearTimeout(t); }, [active, tick, interval, steps.length]); const cur = steps[active]; return ( <section className="bg-canvas px-5 py-16 md:px-[74px] md:py-24"> <style>{`@keyframes stepTick{from{transform:scaleX(0)}to{transform:scaleX(1)}}`}</style> <div className="mx-auto grid max-w-[1300px] items-center gap-12 lg:grid-cols-2"> <div> <Reveal from="up"><h2 className="font-display text-4xl font-semibold leading-[1.05] tracking-[-0.04em] text-ink-deep md:text-6xl">{headline}</h2></Reveal> <div className="mt-10 flex max-w-[614px] flex-col gap-2"> {steps.map((s, i) => { const on = i === active; return ( <button key={i} onClick={() => { setActive(i); setTick((t) => t + 1); }} aria-expanded={on} className={"relative overflow-hidden rounded-[24px] px-6 text-left transition-all duration-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ink " + (on ? "bg-canvas py-5 shadow-ring-raised ring-1 ring-hairline" : "bg-panel py-5")}> {on && <span key={tick + "-" + active} className="absolute left-1/2 top-0 h-[3px] w-[30px] -translate-x-1/2 origin-left rounded-full bg-hairline-strong" style={{ animation: `stepTick ${interval}ms linear forwards` }} />} <span className={"block font-display text-xl font-semibold tracking-[-0.03em] " + (on ? "text-ink-deep" : "text-muted")}>{s.title}</span> <span className={"grid transition-all duration-500 " + (on ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0")}><span className="overflow-hidden"><span className="mt-2 block text-sm text-muted">{s.desc}</span></span></span> </button> ); })} </div> <p className="mt-10 max-w-md text-sm text-body">{footnote}</p> </div> <div className="relative h-[560px] overflow-hidden rounded-[32px] bg-sand md:h-[768px]"> {steps.map((s, i) => ( <img key={i} src={s.photo} alt="" width={1600} height={1067} loading="lazy" className={"absolute inset-0 h-full w-full object-cover grayscale-[40%] sepia-[20%] transition-opacity duration-700 " + (i === active ? "opacity-100" : "opacity-0")} /> ))} <Grain opacity={0.25} blend="overlay" /> <div className="absolute inset-x-5 bottom-5 overflow-hidden rounded-[20px] bg-canvas shadow-soft"> <div className="flex justify-between border-b border-hairline px-4 py-3 text-xs"><span className="font-semibold text-ink-deep">Inbox</span><span className="text-muted">3 unread</span></div> <ul key={active} className="animate-appear-up"> {cur.rows.map((r, i) => ( <li key={i} className="flex items-start gap-3 border-b border-hairline px-4 py-2.5 last:border-0"> <span className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-ink text-xs text-canvas">{r.name[0]}</span> <div className="min-w-0 flex-1 text-xs"> <p className={r.unread ? "font-semibold text-ink-deep" : "text-body"}>{r.name}</p> <p className="truncate text-body"><span className="text-ink-deep">{r.subject}</span> <span className="text-muted">{r.preview}</span></p> </div> <div className="flex flex-col items-end gap-1 text-xs text-muted"><span>{r.time}</span>{r.unread && <span className="h-1.5 w-1.5 rounded-full bg-ink-deep" />}</div> </li> ))} </ul> </div> </div> </div> </section> ); } // ---- Yoink motion (inlined, no dependencies): Reveal, Grain ---- const YK_EASE = "cubic-bezier(0.16, 1, 0.3, 1)"; const useYkLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect; function ykReducedMotion(): boolean { return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches; } // "idle": untouched (visible) · "hidden": waiting below the fold · "shown": play the entrance. // Content is only hidden once we know we can show it again (IntersectionObserver exists, motion allowed, // and there is a box to watch), and a safety net reveals anything on screen that is still hidden. type YkRevealState = "idle" | "hidden" | "shown"; function useYkReveal(ref: RefObject<Element | null>, once = true): YkRevealState { const [state, setState] = useState<YkRevealState>("idle"); useYkLayoutEffect(() => { const el = ref.current; if (!el || ykReducedMotion() || typeof IntersectionObserver === "undefined") return; // watch the element's own box, or its children when it has none (display: contents) const boxes = () => (getComputedStyle(el).display === "contents" ? Array.from(el.children) : [el]); const onScreen = (t: Element) => { const r = t.getBoundingClientRect(); return (r.width > 0 || r.height > 0) && r.bottom > 0 && r.right > 0 && r.top < window.innerHeight && r.left < window.innerWidth; }; if (!boxes().some((t) => t.getBoundingClientRect().width > 0 || t.getBoundingClientRect().height > 0)) return; // e.g. hidden at mount: leave it visible let shown = false; const show = (v: boolean) => { if (v !== shown) (shown = v), setState(v ? "shown" : "hidden"); }; setState("hidden"); const inView = new Set<Element>(); const io = new IntersectionObserver((entries) => { for (const e of entries) { if (e.isIntersecting) inView.add(e.target); else inView.delete(e.target); } if (inView.size) { show(true); if (once) io.disconnect(); } else if (!once) show(false); }); const watched = new Set<Element>(); const watch = () => boxes().forEach((t) => !watched.has(t) && (watched.add(t), io.observe(t))); watch(); // safety net: styles that land after mount (display: contents) get watched too, and nothing // stays hidden for more than a moment while it is actually on screen const start = Date.now(); const net = setInterval(() => { if (shown) return once && clearInterval(net); watch(); if (Date.now() - start > 2400 && boxes().some(onScreen)) show(true); }, 600); return () => { io.disconnect(); clearInterval(net); }; }, [once]); return state; } // Background and overlay layers sit inside their parent: make sure it can hold them. function ykPrepareParent(el: HTMLElement | null, isolate = false) { const p = el?.parentElement; if (!p) return; const cs = getComputedStyle(p); if (cs.position === "static") p.style.position = "relative"; if (isolate && cs.isolation !== "isolate" && cs.zIndex === "auto") p.style.isolation = "isolate"; } type YkRevealFrom = "up" | "down" | "left" | "right" | "scale" | "blur" | "none"; /** Fades content in as it scrolls into view. */ function Reveal({ children, from = "up", delay = 0, duration = 700, distance = 24, once = true, as = "div", className, style, }: { children?: ReactNode; from?: YkRevealFrom; delay?: number; duration?: number; distance?: number; once?: boolean; as?: ElementType; className?: string; style?: CSSProperties; }) { const Tag = as; const ref = useRef<HTMLElement>(null); const state = useYkReveal(ref, once); const hidden = state === "hidden"; const offset = { up: `translate3d(0, ${distance}px, 0)`, down: `translate3d(0, ${-distance}px, 0)`, left: `translate3d(${-distance}px, 0, 0)`, right: `translate3d(${distance}px, 0, 0)`, scale: "scale(0.94)", blur: `translate3d(0, ${distance / 2}px, 0)`, none: "none", }[from]; const t = `${duration}ms ${YK_EASE} ${delay}ms`; return ( <Tag ref={ref} className={className} style={{ ...style, ...(hidden && { opacity: 0, transform: offset, filter: from === "blur" ? "blur(12px)" : undefined }), ...(state === "shown" && { transition: `opacity ${t}, transform ${t}, filter ${t}` }), }} > {children} </Tag> ); } const YK_GRAIN_CSS = `@keyframes yk-grain{0%{transform:translate(0,0)}25%{transform:translate(-3%,2%)}50%{transform:translate(2%,-3%)}75%{transform:translate(-2%,-1%)}100%{transform:translate(1%,3%)}} @media (prefers-reduced-motion:reduce){[data-yk-grain] *{animation:none!important}}`; const YK_NOISE = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 1.6 -0.3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`; /** A film-grain texture over a section (adds tactile depth to flat colour or gradients). */ function Grain({ opacity = 0.12, blend = "overlay", animated = false, className, style, }: { opacity?: number; blend?: CSSProperties["mixBlendMode"]; animated?: boolean; className?: string; style?: CSSProperties; }) { const ref = useRef<HTMLDivElement>(null); useYkLayoutEffect(() => ykPrepareParent(ref.current), []); return ( <div ref={ref} aria-hidden="true" data-yk-grain="" className={className} style={{ position: "absolute", inset: 0, overflow: "hidden", pointerEvents: "none", borderRadius: "inherit", opacity, mixBlendMode: blend, ...style }} > {animated && <style>{YK_GRAIN_CSS}</style>} <div style={{ position: "absolute", inset: "-10%", backgroundImage: YK_NOISE, animation: animated ? "yk-grain 0.9s steps(4) infinite" : undefined }} /> </div> ); }"use client"; import { useLayoutEffect, useRef, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useEffect, useState } from "react"; type Step = { title: string; desc: string; photo: string; rows: { name: string; subject: string; preview: string; time: string; unread?: boolean }[] }; const defaultSteps: Step[] = [ { title: "Stop juggling calendars by hand", desc: "Five people, four cities, nine messages and still no meeting.", photo: "https://yoink-app.fly.dev/stock/people-1.jpg", rows: [ { name: "Mara Quinn", subject: "Re: Kickoff?", preview: "Tuesday at 2 works, sending a hold.", time: "11:03", unread: true }, { name: "Jonas Weber", subject: "Re: Kickoff?", preview: "Can we move it to the afternoon?", time: "09:52", unread: true }, { name: "Mara Quinn", subject: "Kickoff?", preview: "Do you have 45 minutes this week?", time: "09:14", unread: true }, { name: "Ines Alva", subject: "Roadmap notes", preview: "Summary from Monday is in the doc.", time: "Mon" }, { name: "Facilities", subject: "Lift service", preview: "The lift is out of order on Friday.", time: "Mon" } ] }, { title: "Share one link with your open hours", desc: "Your availability, always current, in a single URL.", photo: "https://yoink-app.fly.dev/stock/workspace-3.jpg", rows: [ { name: "You", subject: "Book time with me", preview: "Pick any slot that suits you.", time: "12:10" }, { name: "Mara Quinn", subject: "Re: Book time", preview: "Opening the link now.", time: "12:12", unread: true }, { name: "Jonas Weber", subject: "Re: Book time", preview: "Thanks, this is handy.", time: "12:20", unread: true }, { name: "Ines Alva", subject: "Roadmap notes", preview: "Summary from Monday is in the doc.", time: "Mon" }, { name: "Facilities", subject: "Lift service", preview: "The lift is out of order on Friday.", time: "Mon" } ] }, { title: "Let guests choose", desc: "They pick a slot and the invite lands on every calendar.", photo: "https://yoink-app.fly.dev/stock/people-2.jpg", rows: [ { name: "Calendar", subject: "Confirmed: Kickoff", preview: "Thursday 10:00, video call.", time: "13:01", unread: true }, { name: "Mara Quinn", subject: "Accepted", preview: "See you then.", time: "13:02" }, { name: "Jonas Weber", subject: "Accepted", preview: "Looking forward to it.", time: "13:04" }, { name: "Ines Alva", subject: "Roadmap notes", preview: "Summary from Monday is in the doc.", time: "Mon" }, { name: "Facilities", subject: "Lift service", preview: "The lift is out of order on Friday.", time: "Mon" } ] }, ]; export default function StepAccordionWithGrainPhoto({ headline = "Booking a meeting ate a whole week. Now it takes one link.", steps = defaultSteps, interval = 5000, footnote = "Northwind cuts scheduling time by a third across teams and saves thousands of hours each week." }: { headline?: string; steps?: Step[]; interval?: number; footnote?: string }) { const [active, setActive] = useState(0); const [tick, setTick] = useState(0); useEffect(() => { const t = setTimeout(() => setActive((a) => (a + 1) % steps.length), interval); return () => clearTimeout(t); }, [active, tick, interval, steps.length]); const cur = steps[active]; return ( <section className="bg-background px-5 py-16 md:px-[74px] md:py-24"> <style>{`@keyframes stepTick{from{transform:scaleX(0)}to{transform:scaleX(1)}}`}</style> <div className="mx-auto grid max-w-[1300px] items-center gap-12 lg:grid-cols-2"> <div> <Reveal from="up"><h2 className="font-sans text-4xl font-semibold leading-[1.05] tracking-[-0.04em] text-muted-foreground md:text-6xl">{headline}</h2></Reveal> <div className="mt-10 flex max-w-[614px] flex-col gap-2"> {steps.map((s, i) => { const on = i === active; return ( <button key={i} onClick={() => { setActive(i); setTick((t) => t + 1); }} aria-expanded={on} className={"relative overflow-hidden rounded-[24px] px-6 text-left transition-all duration-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-foreground " + (on ? "bg-background py-5 shadow-warm-ring-raised ring-1 ring-border" : "bg-card py-5")}> {on && <span key={tick + "-" + active} className="absolute left-1/2 top-0 h-[3px] w-[30px] -translate-x-1/2 origin-left rounded-full bg-border" style={{ animation: `stepTick ${interval}ms linear forwards` }} />} <span className={"block font-sans text-xl font-semibold tracking-[-0.03em] " + (on ? "text-muted-foreground" : "text-muted-foreground")}>{s.title}</span> <span className={"grid transition-all duration-500 " + (on ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0")}><span className="overflow-hidden"><span className="mt-2 block text-sm text-muted-foreground">{s.desc}</span></span></span> </button> ); })} </div> <p className="mt-10 max-w-md text-sm text-warm-body">{footnote}</p> </div> <div className="relative h-[560px] overflow-hidden rounded-[32px] bg-foreground md:h-[768px]"> {steps.map((s, i) => ( <img key={i} src={s.photo} alt="" width={1600} height={1067} loading="lazy" className={"absolute inset-0 h-full w-full object-cover grayscale-[40%] sepia-[20%] transition-opacity duration-700 " + (i === active ? "opacity-100" : "opacity-0")} /> ))} <Grain opacity={0.25} blend="overlay" /> <div className="absolute inset-x-5 bottom-5 overflow-hidden rounded-[20px] bg-background shadow-warm-soft"> <div className="flex justify-between border-b border-border px-4 py-3 text-xs"><span className="font-semibold text-muted-foreground">Inbox</span><span className="text-muted-foreground">3 unread</span></div> <ul key={active} className="animate-warm-appear-up"> {cur.rows.map((r, i) => ( <li key={i} className="flex items-start gap-3 border-b border-border px-4 py-2.5 last:border-0"> <span className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground">{r.name[0]}</span> <div className="min-w-0 flex-1 text-xs"> <p className={r.unread ? "font-semibold text-muted-foreground" : "text-warm-body"}>{r.name}</p> <p className="truncate text-warm-body"><span className="text-muted-foreground">{r.subject}</span> <span className="text-muted-foreground">{r.preview}</span></p> </div> <div className="flex flex-col items-end gap-1 text-xs text-muted-foreground"><span>{r.time}</span>{r.unread && <span className="h-1.5 w-1.5 rounded-full bg-foreground" />}</div> </li> ))} </ul> </div> </div> </div> </section> ); } // ---- Yoink motion (inlined, no dependencies): Reveal, Grain ---- const YK_EASE = "cubic-bezier(0.16, 1, 0.3, 1)"; const useYkLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect; function ykReducedMotion(): boolean { return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches; } // "idle": untouched (visible) · "hidden": waiting below the fold · "shown": play the entrance. // Content is only hidden once we know we can show it again (IntersectionObserver exists, motion allowed, // and there is a box to watch), and a safety net reveals anything on screen that is still hidden. type YkRevealState = "idle" | "hidden" | "shown"; function useYkReveal(ref: RefObject<Element | null>, once = true): YkRevealState { const [state, setState] = useState<YkRevealState>("idle"); useYkLayoutEffect(() => { const el = ref.current; if (!el || ykReducedMotion() || typeof IntersectionObserver === "undefined") return; // watch the element's own box, or its children when it has none (display: contents) const boxes = () => (getComputedStyle(el).display === "contents" ? Array.from(el.children) : [el]); const onScreen = (t: Element) => { const r = t.getBoundingClientRect(); return (r.width > 0 || r.height > 0) && r.bottom > 0 && r.right > 0 && r.top < window.innerHeight && r.left < window.innerWidth; }; if (!boxes().some((t) => t.getBoundingClientRect().width > 0 || t.getBoundingClientRect().height > 0)) return; // e.g. hidden at mount: leave it visible let shown = false; const show = (v: boolean) => { if (v !== shown) (shown = v), setState(v ? "shown" : "hidden"); }; setState("hidden"); const inView = new Set<Element>(); const io = new IntersectionObserver((entries) => { for (const e of entries) { if (e.isIntersecting) inView.add(e.target); else inView.delete(e.target); } if (inView.size) { show(true); if (once) io.disconnect(); } else if (!once) show(false); }); const watched = new Set<Element>(); const watch = () => boxes().forEach((t) => !watched.has(t) && (watched.add(t), io.observe(t))); watch(); // safety net: styles that land after mount (display: contents) get watched too, and nothing // stays hidden for more than a moment while it is actually on screen const start = Date.now(); const net = setInterval(() => { if (shown) return once && clearInterval(net); watch(); if (Date.now() - start > 2400 && boxes().some(onScreen)) show(true); }, 600); return () => { io.disconnect(); clearInterval(net); }; }, [once]); return state; } // Background and overlay layers sit inside their parent: make sure it can hold them. function ykPrepareParent(el: HTMLElement | null, isolate = false) { const p = el?.parentElement; if (!p) return; const cs = getComputedStyle(p); if (cs.position === "static") p.style.position = "relative"; if (isolate && cs.isolation !== "isolate" && cs.zIndex === "auto") p.style.isolation = "isolate"; } type YkRevealFrom = "up" | "down" | "left" | "right" | "scale" | "blur" | "none"; /** Fades content in as it scrolls into view. */ function Reveal({ children, from = "up", delay = 0, duration = 700, distance = 24, once = true, as = "div", className, style, }: { children?: ReactNode; from?: YkRevealFrom; delay?: number; duration?: number; distance?: number; once?: boolean; as?: ElementType; className?: string; style?: CSSProperties; }) { const Tag = as; const ref = useRef<HTMLElement>(null); const state = useYkReveal(ref, once); const hidden = state === "hidden"; const offset = { up: `translate3d(0, ${distance}px, 0)`, down: `translate3d(0, ${-distance}px, 0)`, left: `translate3d(${-distance}px, 0, 0)`, right: `translate3d(${distance}px, 0, 0)`, scale: "scale(0.94)", blur: `translate3d(0, ${distance / 2}px, 0)`, none: "none", }[from]; const t = `${duration}ms ${YK_EASE} ${delay}ms`; return ( <Tag ref={ref} className={className} style={{ ...style, ...(hidden && { opacity: 0, transform: offset, filter: from === "blur" ? "blur(12px)" : undefined }), ...(state === "shown" && { transition: `opacity ${t}, transform ${t}, filter ${t}` }), }} > {children} </Tag> ); } const YK_GRAIN_CSS = `@keyframes yk-grain{0%{transform:translate(0,0)}25%{transform:translate(-3%,2%)}50%{transform:translate(2%,-3%)}75%{transform:translate(-2%,-1%)}100%{transform:translate(1%,3%)}} @media (prefers-reduced-motion:reduce){[data-yk-grain] *{animation:none!important}}`; const YK_NOISE = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 1.6 -0.3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`; /** A film-grain texture over a section (adds tactile depth to flat colour or gradients). */ function Grain({ opacity = 0.12, blend = "overlay", animated = false, className, style, }: { opacity?: number; blend?: CSSProperties["mixBlendMode"]; animated?: boolean; className?: string; style?: CSSProperties; }) { const ref = useRef<HTMLDivElement>(null); useYkLayoutEffect(() => ykPrepareParent(ref.current), []); return ( <div ref={ref} aria-hidden="true" data-yk-grain="" className={className} style={{ position: "absolute", inset: 0, overflow: "hidden", pointerEvents: "none", borderRadius: "inherit", opacity, mixBlendMode: blend, ...style }} > {animated && <style>{YK_GRAIN_CSS}</style>} <div style={{ position: "absolute", inset: "-10%", backgroundImage: YK_NOISE, animation: animated ? "yk-grain 0.9s steps(4) infinite" : undefined }} /> </div> ); }
Quality checks
Automated, in a real browser · 4d ago- Accessible: passedNo serious accessibility problems (axe-core): readable contrast, labelled buttons and images.
- Responsive: passedRenders at phone (390px), tablet (768px) and desktop width without sideways scrolling.
- Dark mode: passedStill readable when installed in your theme and switched to dark mode.
- Themeable: passedUses design tokens rather than hard-coded colours, so it follows your theme cleanly.
- Animates cleanly: passedIts animation plays and finishes with everything visible, and it stays still for people who turn on reduced motion.