Quote Card Grid
3x2 grid of surface cards with 16px quoted text at top and a round 40px portrait avatar with name in ink and title in muted gray at bottom.
Rebuilt from cursor.com in the Warm Paper Editorial style.
npx shadcn@latest add https://yoink-app.fly.dev/r/warm-paper-editorial/blocks/quote-card-grid.json
Looks exactly like cursor.com: brings its fonts and colours, namespaced so your own theme stays untouched.
npx shadcn@latest add https://yoink-app.fly.dev/r/warm-paper-editorial/mine/quote-card-grid.json
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 `quotes` array of {quote, name, title}; renders a 3-column grid (2 on tablet, 1 on mobile) of static cards with initials avatars. Renders standalone with defaults.
components/quote-card-grid.tsx
"use client"; import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; type Quote = { quote: string; name: string; title: string }; type Props = { heading?: string; quotes?: Quote[]; }; const defaultQuotes: Quote[] = [ { quote: "“We rolled it out to one team and within a quarter nearly everyone had adopted it. It spread by word of mouth across the whole org.”", name: "Maya Ellison", title: "Partner, Northwind Ventures" }, { quote: "“Our favorite planning tool by a wide margin. Thousands of our engineers now use it daily and our output has climbed noticeably.”", name: "Tomas Reyes", title: "CTO, Altura Systems" }, { quote: "“The best tools give you a dial for control. Make a quick targeted change, or hand over the whole task and let it run end to end.”", name: "Lena Voss", title: "Founder, Kitefield Labs" }, { quote: "“Adoption grew from a few curious people to thousands of enthusiastic colleagues. We invest heavily in tooling, and the payoff here is clear.”", name: "Owen Hartley", title: "Co-Founder, Lumen Pay" }, { quote: "“The most useful tool I pay for, hands down. It is fast, suggests things right when you need them, and fits neatly into how I already work.”", name: "Priya Nair", title: "Creator of open-kit" }, { quote: "“Programming is becoming more fun. We are barely scratching the surface of what is possible, and tools like this show the way forward.”", name: "Sam Okafor", title: "President, Brightmark" }, ]; const tints = ["bg-media-stone", "bg-media-sage", "bg-media-slate", "bg-accent", "bg-ink-muted", "bg-ink"]; function initials(n: string) { return n.split(" ").map((s) => s[0]).join("").slice(0, 2); } export default function QuoteCardGrid({ heading = "A calmer way to ship products.", quotes = defaultQuotes }: Props) { return ( <section className="bg-canvas px-4 py-16 md:px-[70px]"> <h2 className="mb-12 text-center font-sans text-h2 text-ink">{heading}</h2> <Stagger step={80} from="up" className="mx-auto grid max-w-[1300px] gap-[10px] md:grid-cols-2 lg:grid-cols-3"> {quotes.map((q, i) => ( <figure key={q.name} className="m-0 flex min-h-[216px] flex-col justify-between rounded-md border border-hairline bg-surface p-[17px]"> <blockquote className="m-0 text-body text-ink">{q.quote}</blockquote> <figcaption className="mt-8 flex items-center gap-3"> <span aria-hidden="true" className={`flex h-10 w-10 shrink-0 items-center justify-center rounded-pill text-ui text-surface ${tints[i % tints.length]}`}>{initials(q.name)}</span> <span className="flex flex-col"> <span className="text-ui text-ink">{q.name}</span> <span className="text-ui text-ink-muted">{q.title}</span> </span> </figcaption> </figure> ))} </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 Quote = { quote: string; name: string; title: string }; type Props = { heading?: string; quotes?: Quote[]; }; const defaultQuotes: Quote[] = [ { quote: "“We rolled it out to one team and within a quarter nearly everyone had adopted it. It spread by word of mouth across the whole org.”", name: "Maya Ellison", title: "Partner, Northwind Ventures" }, { quote: "“Our favorite planning tool by a wide margin. Thousands of our engineers now use it daily and our output has climbed noticeably.”", name: "Tomas Reyes", title: "CTO, Altura Systems" }, { quote: "“The best tools give you a dial for control. Make a quick targeted change, or hand over the whole task and let it run end to end.”", name: "Lena Voss", title: "Founder, Kitefield Labs" }, { quote: "“Adoption grew from a few curious people to thousands of enthusiastic colleagues. We invest heavily in tooling, and the payoff here is clear.”", name: "Owen Hartley", title: "Co-Founder, Lumen Pay" }, { quote: "“The most useful tool I pay for, hands down. It is fast, suggests things right when you need them, and fits neatly into how I already work.”", name: "Priya Nair", title: "Creator of open-kit" }, { quote: "“Programming is becoming more fun. We are barely scratching the surface of what is possible, and tools like this show the way forward.”", name: "Sam Okafor", title: "President, Brightmark" }, ]; const tints = ["bg-foreground", "bg-muted", "bg-muted", "bg-primary", "bg-foreground", "bg-foreground"]; function initials(n: string) { return n.split(" ").map((s) => s[0]).join("").slice(0, 2); } export default function QuoteCardGrid({ heading = "A calmer way to ship products.", quotes = defaultQuotes }: Props) { return ( <section className="bg-background px-4 py-16 md:px-[70px]"> <h2 className="mb-12 text-center font-sans text-warm-h2 text-foreground">{heading}</h2> <Stagger step={80} from="up" className="mx-auto grid max-w-[1300px] gap-[10px] md:grid-cols-2 lg:grid-cols-3"> {quotes.map((q, i) => ( <figure key={q.name} className="m-0 flex min-h-[216px] flex-col justify-between rounded-md border border-border bg-card p-[17px]"> <blockquote className="m-0 text-warm-body text-foreground">{q.quote}</blockquote> <figcaption className="mt-8 flex items-center gap-3"> <span aria-hidden="true" className={`flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-warm-ui text-card ${tints[i % tints.length]}`}>{initials(q.name)}</span> <span className="flex flex-col"> <span className="text-warm-ui text-foreground">{q.name}</span> <span className="text-warm-ui text-muted-foreground">{q.title}</span> </span> </figcaption> </figure> ))} </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 (11 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 (2 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.