Featured Product Banner with Quiz Glass Chip
Wide forest-green (#3d5b34) rounded panel with the jar on the left and offer details on the right, alongside a tall photo tile (32px radius) with a frosted glass chip at its bottom asking 'Is DS-01 the right probiotic for you? Take the Quiz'.
Rebuilt from seed.com/products 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
All text, prices and the photo are props with defaults (tag, title, description, badge, price, oldPrice, imageSrc, chipText, chipLink). Renders standalone; the jar is an inline SVG and the glass chip sits over the photo tile.
components/feature-product-banner.tsx
"use client"; import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; export default function FeaturedProductBanner({ tag = "FB-02", title = "Evening Calm Blend", description = "Supports restful sleep and steady winding down with 12 gentle botanicals + a soothing mineral complex.*", badge = "25% Off", price = "$28.00", oldPrice = "$37.99", primaryLabel = "Learn More", secondaryLabel = "Add To Cart", brand = "Fernlake", imageSrc = "https://yoink-app.fly.dev/stock/nature-1.jpg", imageAlt = "Sunlight filtering through tall forest trees", chipText = "Is the Evening Calm Blend right for you?", chipLink = "Take the Quiz", }) { return ( <section className="bg-canvas p-4 font-sans"> <Reveal from="up" className="mx-auto flex max-w-[1404px] flex-col gap-4 lg:flex-row"> <div className="flex flex-1 flex-col items-center gap-8 rounded-panel bg-forest-soft p-8 text-canvas md:flex-row md:px-16 md:py-10"> <div className="relative flex h-[280px] w-[300px] shrink-0 items-center justify-center"> <div className="absolute bottom-2 left-6 right-6 h-6 rounded-[50%] bg-black/30 blur-xl" /> <svg viewBox="0 0 200 240" className="relative h-full" aria-label="Product jar" role="img"> <defs> <linearGradient id="jarg" x1="0" x2="1"> <stop offset="0" stopColor="#1f3a1c" /> <stop offset=".5" stopColor="#3a6a34" /> <stop offset="1" stopColor="#1a3018" /> </linearGradient> </defs> <rect x="40" y="14" width="120" height="34" rx="5" fill="#2c4a28" /> <rect x="36" y="44" width="128" height="180" rx="12" fill="url(#jarg)" /> <text x="100" y="84" textAnchor="middle" fontSize="13" fill="#f4f7ee">{brand}</text> <circle cx="100" cy="124" r="5" fill="#e8ece4" /> <text x="100" y="194" textAnchor="middle" fontSize="7" fill="#dfe8d8">{tag} {title.toUpperCase()}</text> </svg> </div> <div className="flex max-w-[620px] flex-col items-start"> <span className="rounded-pill border border-canvas px-2.5 py-0.5 text-label">{tag}</span> <h2 className="mt-2 text-h2">{title}</h2> <p className="mt-5 text-body">{description}</p> <span className="mt-6 rounded-pill bg-lime-highlight px-2 py-0.5 text-caption text-ink">{badge}</span> <p className="mt-1 flex gap-2 text-lead"> <span>{price}</span> <s className="text-canvas">{oldPrice}</s> </p> <div className="mt-6 flex items-center gap-6"> <button className="rounded-pill border border-canvas bg-canvas px-14 py-3.5 text-body text-ink transition-all duration-ui-hover ease-ui-hover hover:bg-transparent hover:text-canvas focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-canvas"> {primaryLabel} </button> <button className="border-b border-canvas pb-0.5 text-body focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-canvas"> {secondaryLabel} </button> </div> </div> </div> <div className="relative h-[450px] w-full overflow-hidden rounded-panel lg:w-[340px] lg:shrink-0"> <img src={imageSrc} alt={imageAlt} width={340} height={450} loading="lazy" className="h-full w-full object-cover" /> <div className="absolute inset-x-4 bottom-4 rounded-tile bg-frost-glass p-4 text-canvas backdrop-blur-[19px] transition-all duration-nav-glass ease-nav-glass"> <p className="text-body">{chipText}</p> <a href="#quiz" className="text-body underline-offset-4 hover:underline focus-visible:underline focus-visible:outline-none"> <span className="font-medium">{chipLink}</span> </a> </div> </div> </Reveal> </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 { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; export default function FeaturedProductBanner({ tag = "FB-02", title = "Evening Calm Blend", description = "Supports restful sleep and steady winding down with 12 gentle botanicals + a soothing mineral complex.*", badge = "25% Off", price = "$28.00", oldPrice = "$37.99", primaryLabel = "Learn More", secondaryLabel = "Add To Cart", brand = "Fernlake", imageSrc = "https://yoink-app.fly.dev/stock/nature-1.jpg", imageAlt = "Sunlight filtering through tall forest trees", chipText = "Is the Evening Calm Blend right for you?", chipLink = "Take the Quiz", }) { return ( <section className="bg-background p-4 font-sans"> <Reveal from="up" className="mx-auto flex max-w-[1404px] flex-col gap-4 lg:flex-row"> <div className="flex flex-1 flex-col items-center gap-8 rounded-2xl bg-foreground p-8 text-background md:flex-row md:px-16 md:py-10"> <div className="relative flex h-[280px] w-[300px] shrink-0 items-center justify-center"> <div className="absolute bottom-2 left-6 right-6 h-6 rounded-[50%] bg-foreground/30 blur-xl" /> <svg viewBox="0 0 200 240" className="relative h-full" aria-label="Product jar" role="img"> <defs> <linearGradient id="jarg" x1="0" x2="1"> <stop offset="0" stopColor="#1f3a1c" /> <stop offset=".5" stopColor="#3a6a34" /> <stop offset="1" stopColor="#1a3018" /> </linearGradient> </defs> <rect x="40" y="14" width="120" height="34" rx="5" fill="#2c4a28" /> <rect x="36" y="44" width="128" height="180" rx="12" fill="url(#jarg)" /> <text x="100" y="84" textAnchor="middle" fontSize="13" fill="#f4f7ee">{brand}</text> <circle cx="100" cy="124" r="5" fill="#e8ece4" /> <text x="100" y="194" textAnchor="middle" fontSize="7" fill="#dfe8d8">{tag} {title.toUpperCase()}</text> </svg> </div> <div className="flex max-w-[620px] flex-col items-start"> <span className="rounded-full border border-background px-2.5 py-0.5 text-verdant-label">{tag}</span> <h2 className="mt-2 text-verdant-h2">{title}</h2> <p className="mt-5 text-verdant-body">{description}</p> <span className="mt-6 rounded-full bg-verdant-lime-highlight px-2 py-0.5 text-verdant-caption text-foreground">{badge}</span> <p className="mt-1 flex gap-2 text-verdant-lead"> <span>{price}</span> <s className="text-background">{oldPrice}</s> </p> <div className="mt-6 flex items-center gap-6"> <button className="rounded-full border border-background bg-background px-14 py-3.5 text-verdant-body text-foreground transition-all duration-verdant-ui-hover ease-verdant-ui-hover hover:bg-transparent hover:text-background focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-background"> {primaryLabel} </button> <button className="border-b border-background pb-0.5 text-verdant-body focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-background"> {secondaryLabel} </button> </div> </div> </div> <div className="relative h-[450px] w-full overflow-hidden rounded-2xl lg:w-[340px] lg:shrink-0"> <img src={imageSrc} alt={imageAlt} width={340} height={450} loading="lazy" className="h-full w-full object-cover" /> <div className="absolute inset-x-4 bottom-4 rounded-xl bg-foreground p-4 text-background backdrop-blur-[19px] transition-all duration-verdant-nav-glass ease-verdant-nav-glass"> <p className="text-verdant-body">{chipText}</p> <a href="#quiz" className="text-verdant-body underline-offset-4 hover:underline focus-visible:underline focus-visible:outline-none"> <span className="font-medium">{chipLink}</span> </a> </div> </div> </Reveal> </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: not passedElements must meet minimum color contrast ratio thresholds (1 element)
- Themeable: not passed4 hard-coded colours (#2c4a28, #f4f7ee, #e8ece4, #dfe8d8). These ignore the theme and break dark mode.
- Animates cleanly: passedIts animation plays and finishes with everything visible, and it stays still for people who turn on reduced motion.