Page sections / Feature sections
Timeline Benefit Tiles
Heading on the left and a row of four soft rounded (20px) light tiles on a foam-coloured band. Each tile has a thin line icon, a small time label (7 Days, 2 Weeks, 4 Weeks, 3 Months) and a medium-weight benefit statement with dagger footnote marks.
Rebuilt from seed.com in the Verdant Lab Editorial style.
Looks exactly like seed.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
Pass `heading` and a `tiles` array of {time, text, mark, icon} (icon: gut | clock | leaf | ring). Renders standalone with defaults; tiles stagger in on scroll and lift on hover.
components/benefit-timeline-tiles.tsx
"use client"; import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; type Tile = { time: string; text: string; mark?: string; icon: "gut" | "clock" | "leaf" | "ring" }; type Props = { heading?: string; tiles?: Tile[]; }; const defaultTiles: Tile[] = [ { time: "5 Days", text: "Calmer, steadier mornings", mark: "*†", icon: "gut" }, { time: "3 Weeks", text: "Supports restful, even sleep", mark: "†", icon: "clock" }, { time: "6 Weeks", text: "Visible glow and softer texture", mark: "‡", icon: "leaf" }, { time: "2 Months", text: "Sustained everyday vitality", mark: "†", icon: "ring" }, ]; function Icon({ name }: { name: Tile["icon"] }) { const p = { fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round" as const, strokeLinejoin: "round" as const }; return ( <svg viewBox="0 0 32 32" width="32" height="32" aria-hidden="true" className="text-ink"> {name === "gut" && <path {...p} d="M6 5c8 0 14 2 14 8s-8 4-8 9 4 6 8 6M24 4l1.5-2M27 8l2-1" />} {name === "clock" && ( <g {...p}> <circle cx="16" cy="16" r="13" /> <path d="M16 8v8l5 4" /> </g> )} {name === "leaf" && ( <g {...p}> <path d="M3 26h26M5 22c6 0 8-6 8-12M27 22c-6 0-8-6-8-12" /> <path d="M16 10c-3 4-3 8 0 10 3-2 3-6 0-10z" /> </g> )} {name === "ring" && ( <g {...p}> <circle cx="16" cy="5" r="3" /> <circle cx="26" cy="11" r="3" /> <circle cx="26" cy="21" r="3" /> <circle cx="16" cy="27" r="3" /> <circle cx="6" cy="21" r="3" /> <circle cx="6" cy="11" r="3" /> </g> )} </svg> ); } export default function TimelineBenefitTiles({ heading = "Noticeable results you can expect in as little as 5 days.", tiles = defaultTiles, }: Props) { return ( <section className="bg-surface-foam py-12 md:py-16"> <div className="mx-auto grid max-w-[1280px] items-center gap-8 px-6 lg:grid-cols-[360px_1fr] lg:gap-16"> <Reveal from="up"> <h2 className="font-sans text-h2 text-ink">{heading}</h2> </Reveal> <Stagger step={100} from="up" className="grid gap-2 sm:grid-cols-2 lg:grid-cols-4"> {tiles.map((t) => ( <div key={t.time} className="flex h-full flex-col gap-5 rounded-[20px] bg-surface p-6 transition-all duration-ui-hover ease-ui-hover hover:-translate-y-1 hover:shadow-capsule-drop" > <Icon name={t.icon} /> <div> <p className="mb-2 text-body text-ink">{t.time}</p> <p className="font-medium text-ink"> {t.text} {t.mark && <sup className="text-caption">{t.mark}</sup>} </p> </div> </div> ))} </Stagger> </div> </section> ); } // ---- Yoink motion (inlined, no dependencies): Reveal, Stagger ---- 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; } 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> ); } /** Reveals each direct child one after another when the group scrolls into view. */ function Stagger({ children, step = 90, from = "up", distance = 20, duration = 650, delay = 0, once = true, as = "div", className, style, }: { children?: ReactNode; step?: number; from?: "up" | "down" | "left" | "right" | "scale" | "fade"; distance?: number; duration?: number; delay?: number; once?: boolean; as?: ElementType; className?: string; style?: CSSProperties; }) { const Tag = as; const ref = useRef<HTMLElement>(null); const state = useYkReveal(ref, once); useYkLayoutEffect(() => { const items = Array.from(ref.current?.children ?? []) as HTMLElement[]; if (state === "idle") return; 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.92)", fade: "none", }[from]; if (state === "hidden") { for (const el of items) Object.assign(el.style, { transition: "none", opacity: "0", transform: offset }); return; } items.forEach((el, i) => { const t = `${duration}ms ${YK_EASE} ${delay + i * step}ms`; Object.assign(el.style, { transition: `opacity ${t}, transform ${t}`, opacity: "", transform: "" }); }); // hand the children their own transitions back once everything has landed const done = setTimeout(() => items.forEach((el) => (el.style.transition = "")), delay + items.length * step + duration + 50); return () => clearTimeout(done); }, [state]); return ( <Tag ref={ref} className={className} style={style}> {children} </Tag> ); }"use client"; import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; type Tile = { time: string; text: string; mark?: string; icon: "gut" | "clock" | "leaf" | "ring" }; type Props = { heading?: string; tiles?: Tile[]; }; const defaultTiles: Tile[] = [ { time: "5 Days", text: "Calmer, steadier mornings", mark: "*†", icon: "gut" }, { time: "3 Weeks", text: "Supports restful, even sleep", mark: "†", icon: "clock" }, { time: "6 Weeks", text: "Visible glow and softer texture", mark: "‡", icon: "leaf" }, { time: "2 Months", text: "Sustained everyday vitality", mark: "†", icon: "ring" }, ]; function Icon({ name }: { name: Tile["icon"] }) { const p = { fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round" as const, strokeLinejoin: "round" as const }; return ( <svg viewBox="0 0 32 32" width="32" height="32" aria-hidden="true" className="text-foreground"> {name === "gut" && <path {...p} d="M6 5c8 0 14 2 14 8s-8 4-8 9 4 6 8 6M24 4l1.5-2M27 8l2-1" />} {name === "clock" && ( <g {...p}> <circle cx="16" cy="16" r="13" /> <path d="M16 8v8l5 4" /> </g> )} {name === "leaf" && ( <g {...p}> <path d="M3 26h26M5 22c6 0 8-6 8-12M27 22c-6 0-8-6-8-12" /> <path d="M16 10c-3 4-3 8 0 10 3-2 3-6 0-10z" /> </g> )} {name === "ring" && ( <g {...p}> <circle cx="16" cy="5" r="3" /> <circle cx="26" cy="11" r="3" /> <circle cx="26" cy="21" r="3" /> <circle cx="16" cy="27" r="3" /> <circle cx="6" cy="21" r="3" /> <circle cx="6" cy="11" r="3" /> </g> )} </svg> ); } export default function TimelineBenefitTiles({ heading = "Noticeable results you can expect in as little as 5 days.", tiles = defaultTiles, }: Props) { return ( <section className="bg-muted py-12 md:py-16"> <div className="mx-auto grid max-w-[1280px] items-center gap-8 px-6 lg:grid-cols-[360px_1fr] lg:gap-16"> <Reveal from="up"> <h2 className="font-sans text-verdant-h2 text-foreground">{heading}</h2> </Reveal> <Stagger step={100} from="up" className="grid gap-2 sm:grid-cols-2 lg:grid-cols-4"> {tiles.map((t) => ( <div key={t.time} className="flex h-full flex-col gap-5 rounded-[20px] bg-card p-6 transition-all duration-verdant-ui-hover ease-verdant-ui-hover hover:-translate-y-1 hover:shadow-verdant-capsule-drop" > <Icon name={t.icon} /> <div> <p className="mb-2 text-verdant-body text-foreground">{t.time}</p> <p className="font-medium text-foreground"> {t.text} {t.mark && <sup className="text-verdant-caption">{t.mark}</sup>} </p> </div> </div> ))} </Stagger> </div> </section> ); } // ---- Yoink motion (inlined, no dependencies): Reveal, Stagger ---- 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; } 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> ); } /** Reveals each direct child one after another when the group scrolls into view. */ function Stagger({ children, step = 90, from = "up", distance = 20, duration = 650, delay = 0, once = true, as = "div", className, style, }: { children?: ReactNode; step?: number; from?: "up" | "down" | "left" | "right" | "scale" | "fade"; distance?: number; duration?: number; delay?: number; once?: boolean; as?: ElementType; className?: string; style?: CSSProperties; }) { const Tag = as; const ref = useRef<HTMLElement>(null); const state = useYkReveal(ref, once); useYkLayoutEffect(() => { const items = Array.from(ref.current?.children ?? []) as HTMLElement[]; if (state === "idle") return; 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.92)", fade: "none", }[from]; if (state === "hidden") { for (const el of items) Object.assign(el.style, { transition: "none", opacity: "0", transform: offset }); return; } items.forEach((el, i) => { const t = `${duration}ms ${YK_EASE} ${delay + i * step}ms`; Object.assign(el.style, { transition: `opacity ${t}, transform ${t}`, opacity: "", transform: "" }); }); // hand the children their own transitions back once everything has landed const done = setTimeout(() => items.forEach((el) => (el.style.transition = "")), delay + items.length * step + duration + 50); return () => clearTimeout(done); }, [state]); return ( <Tag ref={ref} className={className} style={style}> {children} </Tag> ); }
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.