Page sections / Feature sections
Glass Panel Annotated Capsule
Huge rounded (32px) frosted green glass panel over a macro bacteria photograph and looping capsule video. Left: dot marker, light headline, white pill CTA and an outlined stat card with a small pill tag and '17x'. Right: uppercase callouts with dashed leader lines pointing to the capsule layers. A circular pause control sits bottom right.
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
Props set headline, CTA, tag, stat and the two callout titles/bodies; imageSrc swaps the backdrop photo. Callouts drift in opposite directions on scroll, and the round button toggles the pause state of the animated capsule.
components/glass-capsule-explainer.tsx
"use client"; import { useLayoutEffect, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useEffect, useRef, useState } from "react"; export default function GlassPanelAnnotatedCapsule({ headline = "Most capsules never reach their destination — Verdana-9 does.", ctaLabel = "Shop Verdana-9", tag = "Verdana-9", statText = "boosts beneficial flora", statValue = "17x", outerTitle = "Outer shell layer", outerBody = "Protects the core from harsh acid, while releasing a gentle prebiotic to feed good bacteria along the way.", innerTitle = "Inner core layer", innerBody = "Carries 24 live strains safely to the colon, where they are needed most.", imageSrc = "https://yoink-app.fly.dev/stock/nature-2.jpg", }: { headline?: string; ctaLabel?: string; tag?: string; statText?: string; statValue?: string; outerTitle?: string; outerBody?: string; innerTitle?: string; innerBody?: string; imageSrc?: string; }) { const [paused, setPaused] = useState(false); const [p, setP] = useState(0); const ref = useRef<HTMLElement>(null); useEffect(() => { const onScroll = () => { const el = ref.current; if (!el) return; const r = el.getBoundingClientRect(); const v = window.innerHeight; const t = (v - r.top) / (v + r.height); setP(Math.max(0, Math.min(1, t))); }; onScroll(); window.addEventListener("scroll", onScroll, { passive: true }); return () => window.removeEventListener("scroll", onScroll); }, []); const shift = (p - 0.5) * 40; return ( <section ref={ref} className="relative isolate overflow-hidden bg-forest-soft px-4 py-20 font-sans text-canvas md:px-8"> <img src={imageSrc} alt="" width={1600} height={1200} className="absolute inset-0 -z-10 h-full w-full object-cover" /> <div className="relative overflow-hidden rounded-[32px] border border-canvas/20 bg-frost-glass backdrop-blur-[37px]"> <div className="relative grid gap-12 px-6 py-16 md:grid-cols-[minmax(0,1fr)_minmax(0,1.3fr)] md:px-20 md:py-20"> <Reveal from="up" className="flex flex-col items-start"> <span className="mb-10 block h-3 w-3 rounded-full bg-canvas" /> <h2 className="max-w-md text-h1 font-light text-canvas">{headline}</h2> <button className="mt-8 rounded-pill bg-canvas px-6 py-3.5 text-body text-ink transition-all duration-ui-hover ease-ui-hover hover:bg-pure-white focus-visible:outline focus-visible:outline-2 focus-visible:outline-canvas">{ctaLabel}</button> <div className="mt-10 flex w-full max-w-[354px] items-center justify-between gap-4 rounded-card border border-canvas/30 px-8 py-8"> <p className="text-lead font-light"> <span className="mr-2 inline-block rounded-pill border border-canvas/70 px-2 py-0.5 align-middle text-caption font-medium">{tag}</span> {statText} </p> <span className="text-h2 font-light">{statValue}</span> </div> </Reveal> <div className="relative min-h-[320px] md:min-h-[400px]"> <div className="absolute left-0 top-0 flex items-start gap-4 transition-transform duration-parallax-callout ease-parallax-callout" style={{ transform: `translateY(${shift}px)` }} > <div className="max-w-[200px]"> <h3 className="text-caption font-medium uppercase">{outerTitle}</h3> <p className="mt-1 text-caption opacity-90">{outerBody}</p> </div> <span className="mt-6 hidden w-[70px] border-t border-dashed border-canvas/70 md:block" /> </div> <div className="absolute bottom-0 right-0 flex items-start gap-4 transition-transform duration-parallax-callout ease-parallax-callout md:bottom-auto md:top-28" style={{ transform: `translateY(${-shift}px)` }} > <span className="mt-8 hidden w-[70px] border-t border-dashed border-canvas/70 md:block" /> <div className="max-w-[180px]"> <h3 className="text-caption font-medium uppercase">{innerTitle}</h3> <p className="mt-1 text-caption opacity-90">{innerBody}</p> </div> </div> <div aria-hidden="true" className={`absolute left-1/2 top-1/2 h-48 w-48 -translate-x-1/2 -translate-y-1/2 rounded-full bg-[radial-gradient(circle_at_35%_30%,var(--color-lemongrass),var(--color-faded-green)_60%,transparent_72%)] opacity-60 ${paused ? "" : "animate-pulse"}`} /> </div> </div> </div> <button type="button" aria-label={paused ? "Play video" : "Pause video"} aria-pressed={paused} onClick={() => setPaused((v) => !v)} className="absolute bottom-4 right-6 flex h-11 w-11 items-center justify-center rounded-full bg-scrim text-canvas focus-visible:outline focus-visible:outline-2 focus-visible:outline-canvas" > {paused ? ( <svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor"><path d="M2 1l9 5-9 5z" /></svg> ) : ( <svg width="10" height="12" viewBox="0 0 10 12" fill="currentColor"><rect width="3" height="12" /><rect x="7" width="3" height="12" /></svg> )} </button> </section> ); } // ---- Yoink motion (inlined, no dependencies): Reveal ---- 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> ); }"use client"; import { useLayoutEffect, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useEffect, useRef, useState } from "react"; export default function GlassPanelAnnotatedCapsule({ headline = "Most capsules never reach their destination — Verdana-9 does.", ctaLabel = "Shop Verdana-9", tag = "Verdana-9", statText = "boosts beneficial flora", statValue = "17x", outerTitle = "Outer shell layer", outerBody = "Protects the core from harsh acid, while releasing a gentle prebiotic to feed good bacteria along the way.", innerTitle = "Inner core layer", innerBody = "Carries 24 live strains safely to the colon, where they are needed most.", imageSrc = "https://yoink-app.fly.dev/stock/nature-2.jpg", }: { headline?: string; ctaLabel?: string; tag?: string; statText?: string; statValue?: string; outerTitle?: string; outerBody?: string; innerTitle?: string; innerBody?: string; imageSrc?: string; }) { const [paused, setPaused] = useState(false); const [p, setP] = useState(0); const ref = useRef<HTMLElement>(null); useEffect(() => { const onScroll = () => { const el = ref.current; if (!el) return; const r = el.getBoundingClientRect(); const v = window.innerHeight; const t = (v - r.top) / (v + r.height); setP(Math.max(0, Math.min(1, t))); }; onScroll(); window.addEventListener("scroll", onScroll, { passive: true }); return () => window.removeEventListener("scroll", onScroll); }, []); const shift = (p - 0.5) * 40; return ( <section ref={ref} className="relative isolate overflow-hidden bg-foreground px-4 py-20 font-sans text-background md:px-8"> <img src={imageSrc} alt="" width={1600} height={1200} className="absolute inset-0 -z-10 h-full w-full object-cover" /> <div className="relative overflow-hidden rounded-[32px] border border-background/20 bg-foreground backdrop-blur-[37px]"> <div className="relative grid gap-12 px-6 py-16 md:grid-cols-[minmax(0,1fr)_minmax(0,1.3fr)] md:px-20 md:py-20"> <Reveal from="up" className="flex flex-col items-start"> <span className="mb-10 block h-3 w-3 rounded-full bg-background" /> <h2 className="max-w-md text-verdant-h1 font-light text-background">{headline}</h2> <button className="mt-8 rounded-full bg-background px-6 py-3.5 text-verdant-body text-foreground transition-all duration-verdant-ui-hover ease-verdant-ui-hover hover:bg-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-background">{ctaLabel}</button> <div className="mt-10 flex w-full max-w-[354px] items-center justify-between gap-4 rounded-2xl border border-background/30 px-8 py-8"> <p className="text-verdant-lead font-light"> <span className="mr-2 inline-block rounded-full border border-background/70 px-2 py-0.5 align-middle text-verdant-caption font-medium">{tag}</span> {statText} </p> <span className="text-verdant-h2 font-light">{statValue}</span> </div> </Reveal> <div className="relative min-h-[320px] md:min-h-[400px]"> <div className="absolute left-0 top-0 flex items-start gap-4 transition-transform duration-verdant-parallax-callout ease-verdant-parallax-callout" style={{ transform: `translateY(${shift}px)` }} > <div className="max-w-[200px]"> <h3 className="text-verdant-caption font-medium uppercase">{outerTitle}</h3> <p className="mt-1 text-verdant-caption opacity-90">{outerBody}</p> </div> <span className="mt-6 hidden w-[70px] border-t border-dashed border-background/70 md:block" /> </div> <div className="absolute bottom-0 right-0 flex items-start gap-4 transition-transform duration-verdant-parallax-callout ease-verdant-parallax-callout md:bottom-auto md:top-28" style={{ transform: `translateY(${-shift}px)` }} > <span className="mt-8 hidden w-[70px] border-t border-dashed border-background/70 md:block" /> <div className="max-w-[180px]"> <h3 className="text-verdant-caption font-medium uppercase">{innerTitle}</h3> <p className="mt-1 text-verdant-caption opacity-90">{innerBody}</p> </div> </div> <div aria-hidden="true" className={`absolute left-1/2 top-1/2 h-48 w-48 -translate-x-1/2 -translate-y-1/2 rounded-full bg-[radial-gradient(circle_at_35%_30%,var(--color-muted),var(--color-muted-foreground)_60%,transparent_72%)] opacity-60 ${paused ? "" : "animate-pulse"}`} /> </div> </div> </div> <button type="button" aria-label={paused ? "Play video" : "Pause video"} aria-pressed={paused} onClick={() => setPaused((v) => !v)} className="absolute bottom-4 right-6 flex h-11 w-11 items-center justify-center rounded-full bg-primary text-primary-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-background" > {paused ? ( <svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor"><path d="M2 1l9 5-9 5z" /></svg> ) : ( <svg width="10" height="12" viewBox="0 0 10 12" fill="currentColor"><rect width="3" height="12" /><rect x="7" width="3" height="12" /></svg> )} </button> </section> ); } // ---- Yoink motion (inlined, no dependencies): Reveal ---- 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> ); }
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: not passedKeeps animating when reduced motion is turned on