Product Listing Card
Soft off-white (20px) card with a jar image on the left and a text column on the right: outlined code pill, name, short description, lime '30% Off' badge, bold price with muted strikethrough original, a dark pill 'Learn More' and an underlined 'Add To Cart' text link. Displayed in a 2-column grid; featured variant uses forest-green fill with light text and a cream button.
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
Pass a `products` array (code, name, description, price, original, image, optional waitlist/featured). Featured uses the green fill with a light button; waitlist swaps the Add To Cart link for a single pill button.
components/product-split-card.tsx
"use client"; import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; type Product = { code: string; name: string; description: string; price: string; original: string; image: string; waitlist?: boolean; featured?: boolean; }; const defaultProducts: Product[] = [ { code: "HB-11", name: "Morning Greens Blend", description: "A gentle plant-based powder that adds fiber and leafy nutrients to your breakfast routine.*", price: "$26.00", original: "$37.50", image: "https://yoink-app.fly.dev/stock/nature-2.jpg" }, { code: "HB-12", name: "Calm Tea Pair", description: "Two soothing herbal blends designed to pair for an easy, unhurried evening.*", price: "$48.00", original: "$68.50", image: "https://yoink-app.fly.dev/stock/food-2.jpg", featured: true }, { code: "HB-21", name: "Clear Focus Drops", description: "Light citrus tincture that helps you stay sharp through long afternoons without jitters.*", price: "$22.50", original: "$32.00", image: "https://yoink-app.fly.dev/stock/product-2.jpg" }, { code: "HB-22", name: "Evening Wind-Down", description: "Chamomile-forward chews that ease you toward a quiet, steady night.*", price: "$22.50", original: "$32.00", image: "https://yoink-app.fly.dev/stock/product-1.jpg" }, { code: "HB-31", name: "Little Ones Gummies", description: "Fruit-sweetened daily gummies made for growing kids and teens (ages 4-16) with five nutrients.*", price: "$26.00", original: "$37.50", image: "https://yoink-app.fly.dev/stock/food-5.jpg" }, { code: "HB-41", name: "Starter Skin Kit", description: "A simple three-step kit that helps skin feel balanced, hydrated and comfortable day to day.*", price: "$64.00", original: "$91.00", image: "https://yoink-app.fly.dev/stock/product-3.jpg", waitlist: true }, ]; export default function ProductListingCard({ products = defaultProducts }: { products?: Product[] }) { return ( <section className="bg-canvas p-4 font-sans text-ink"> <Stagger className="grid gap-4 md:grid-cols-2" step={90}> {products.map((p) => ( <article key={p.code} className={`grid items-center gap-4 rounded-card p-4 sm:grid-cols-[1fr_1.1fr] sm:gap-6 ${p.featured ? "bg-forest-soft text-canvas" : "bg-surface text-ink"}`}> <div className="flex aspect-[4/3] items-center justify-center"> <img src={p.image} alt={p.name} width={332} height={250} loading="lazy" className="h-full w-full rounded-tile object-contain" /> </div> <div className="flex flex-col items-start gap-3 py-4 pr-2"> <span className="rounded-pill border border-current px-2 py-0.5 text-caption">{p.code}</span> <h3 className="text-h3">{p.name}</h3> <p className="text-body">{p.description}</p> <span className="rounded-pill bg-lime-highlight px-2.5 py-0.5 text-caption text-ink">30% Off</span> <p className="text-h3"> {p.price} <span className="text-ink-50 line-through">{p.original}</span> </p> <div className="flex flex-wrap items-center gap-6"> <button className={`rounded-pill px-8 py-3.5 text-body transition-all duration-ui-hover ease-ui-hover focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 ${p.featured ? "bg-pure-white text-ink hover:bg-surface" : "bg-ink text-canvas hover:opacity-85"}`}> {p.waitlist ? "Join the Waitlist" : "Learn More"} </button> {!p.waitlist && ( <a href="#" className="border-b border-current pb-0.5 text-body font-medium transition-all duration-ui-hover ease-ui-hover hover:opacity-60 focus-visible:outline focus-visible:outline-2">Add To Cart</a> )} </div> </div> </article> ))} </Stagger> </section> ); } // ---- Yoink motion (inlined, no dependencies): 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; } /** 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 Product = { code: string; name: string; description: string; price: string; original: string; image: string; waitlist?: boolean; featured?: boolean; }; const defaultProducts: Product[] = [ { code: "HB-11", name: "Morning Greens Blend", description: "A gentle plant-based powder that adds fiber and leafy nutrients to your breakfast routine.*", price: "$26.00", original: "$37.50", image: "https://yoink-app.fly.dev/stock/nature-2.jpg" }, { code: "HB-12", name: "Calm Tea Pair", description: "Two soothing herbal blends designed to pair for an easy, unhurried evening.*", price: "$48.00", original: "$68.50", image: "https://yoink-app.fly.dev/stock/food-2.jpg", featured: true }, { code: "HB-21", name: "Clear Focus Drops", description: "Light citrus tincture that helps you stay sharp through long afternoons without jitters.*", price: "$22.50", original: "$32.00", image: "https://yoink-app.fly.dev/stock/product-2.jpg" }, { code: "HB-22", name: "Evening Wind-Down", description: "Chamomile-forward chews that ease you toward a quiet, steady night.*", price: "$22.50", original: "$32.00", image: "https://yoink-app.fly.dev/stock/product-1.jpg" }, { code: "HB-31", name: "Little Ones Gummies", description: "Fruit-sweetened daily gummies made for growing kids and teens (ages 4-16) with five nutrients.*", price: "$26.00", original: "$37.50", image: "https://yoink-app.fly.dev/stock/food-5.jpg" }, { code: "HB-41", name: "Starter Skin Kit", description: "A simple three-step kit that helps skin feel balanced, hydrated and comfortable day to day.*", price: "$64.00", original: "$91.00", image: "https://yoink-app.fly.dev/stock/product-3.jpg", waitlist: true }, ]; export default function ProductListingCard({ products = defaultProducts }: { products?: Product[] }) { return ( <section className="bg-background p-4 font-sans text-foreground"> <Stagger className="grid gap-4 md:grid-cols-2" step={90}> {products.map((p) => ( <article key={p.code} className={`grid items-center gap-4 rounded-2xl p-4 sm:grid-cols-[1fr_1.1fr] sm:gap-6 ${p.featured ? "bg-foreground text-background" : "bg-card text-foreground"}`}> <div className="flex aspect-[4/3] items-center justify-center"> <img src={p.image} alt={p.name} width={332} height={250} loading="lazy" className="h-full w-full rounded-xl object-contain" /> </div> <div className="flex flex-col items-start gap-3 py-4 pr-2"> <span className="rounded-full border border-current px-2 py-0.5 text-verdant-caption">{p.code}</span> <h3 className="text-verdant-h3">{p.name}</h3> <p className="text-verdant-body">{p.description}</p> <span className="rounded-full bg-verdant-lime-highlight px-2.5 py-0.5 text-verdant-caption text-foreground">30% Off</span> <p className="text-verdant-h3"> {p.price} <span className="text-muted-foreground line-through">{p.original}</span> </p> <div className="flex flex-wrap items-center gap-6"> <button className={`rounded-full px-8 py-3.5 text-verdant-body transition-all duration-verdant-ui-hover ease-verdant-ui-hover focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 ${p.featured ? "bg-muted text-foreground hover:bg-card" : "bg-foreground text-background hover:opacity-85"}`}> {p.waitlist ? "Join the Waitlist" : "Learn More"} </button> {!p.waitlist && ( <a href="#" className="border-b border-current pb-0.5 text-verdant-body font-medium transition-all duration-verdant-ui-hover ease-verdant-ui-hover hover:opacity-60 focus-visible:outline focus-visible:outline-2">Add To Cart</a> )} </div> </div> </article> ))} </Stagger> </section> ); } // ---- Yoink motion (inlined, no dependencies): 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; } /** 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: not passedElements must meet minimum color contrast ratio thresholds (6 elements)
- Responsive: passedRenders at phone (390px), tablet (768px) and desktop width without sideways scrolling.
- Dark mode: not passedElements must meet minimum color contrast ratio thresholds (7 elements)
- 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.