Emphasised Quote Card Row
Four equal white hairline cards with quotes in grey where key phrases are darkened for emphasis, then a bottom byline with round avatar, name and monospace uppercase 'COMPANY – ROLE' caption.
Rebuilt from supabase.com/solutions/ai-builders in the Emerald Paper Precision style.
npx shadcn@latest add https://justyoink.it/r/emerald-paper-precision/blocks/quote-cards-with-roles.json
Looks exactly like supabase.com: brings its fonts and colours, namespaced so your own theme stays untouched.
npx shadcn@latest add https://justyoink.it/r/emerald-paper-precision/mine/quote-cards-with-roles.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 a `quotes` array of {parts, name, company, role, from, to}; parts marked `em: true` are darkened for emphasis, and from/to set the avatar gradient. Renders standalone with defaults.
components/quote-cards-with-roles.tsx
"use client"; import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; type Part = { t: string; em?: boolean }; type Quote = { parts: Part[]; name: string; company: string; role: string; from: string; to: string }; const defaultQuotes: Quote[] = [ { parts: [{ t: "“We picked Northwind because setup was " }, { t: "refreshingly simple", em: true }, { t: " and the docs were clear. It " }, { t: "covers every need for our reporting stack", em: true }, { t: ".”" }], name: "Maya Lindqvist", company: "Kitefield", role: "CEO", from: "#34d399", to: "#065f46" }, { parts: [{ t: "“Northwind is dependable. The " }, { t: "scheduling engine", em: true }, { t: " just works, and it's the " }, { t: "most thoughtful tool we've adopted", em: true }, { t: " for planning and tracking work.”" }], name: "Theo Marchetti", company: "Altura", role: "CEO", from: "#60a5fa", to: "#1e3a8a" }, { parts: [{ t: "“Lumen plugs into Northwind " }, { t: "without any friction.", em: true }, { t: " If you ask the assistant to draft a workflow, it knows what it needs, " }, { t: "and you'll be guided to connect a workspace right there in the editor", em: true }, { t: ".”" }], name: "Priya Raman", company: "Lumen Labs", role: "CEO", from: "#a78bfa", to: "#312e81" }, { parts: [{ t: "“Northwind is the " }, { t: "missing layer for building modern web apps", em: true }, { t: " and has been " }, { t: "our default for a long while", em: true }, { t: ". Our team loves it and so do our users.”" }], name: "Jonas Berg", company: "Orchard", role: "CEO", from: "#fbbf24", to: "#78350f" }, ]; export default function EmphasisedQuoteCardRow({ quotes = defaultQuotes }: { quotes?: Quote[] }) { return ( <section className="bg-canvas px-4 py-12 sm:px-6"> <Stagger step={90} from="up" className="mx-auto grid max-w-[1088px] gap-4 sm:grid-cols-2 lg:grid-cols-4"> {quotes.map((q, i) => ( <figure key={i} className="relative flex min-h-[256px] flex-col justify-between rounded-xl border border-hairline bg-surface p-5 transition-colors duration-hover-color ease-hover-color hover:border-hairline-strong"> <blockquote className="font-sans text-[15px] leading-[22.5px] text-ink-muted"> {q.parts.map((p, j) => ( <span key={j} className={p.em ? "text-ink" : undefined}>{p.t}</span> ))} </blockquote> <figcaption className="mt-8 flex items-center gap-3"> <span aria-hidden className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-[12px] font-medium text-white" style={{ background: `linear-gradient(135deg, ${q.from}, ${q.to})` }}> {q.name.split(" ").map((n) => n[0]).join("")} </span> <span className="flex flex-col"> <span className="font-sans text-[15px] leading-5 text-ink-soft">{q.name}</span> <span className="font-mono text-[13px] uppercase leading-[18px] text-ink-muted">{q.company} – {q.role}</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 Part = { t: string; em?: boolean }; type Quote = { parts: Part[]; name: string; company: string; role: string; from: string; to: string }; const defaultQuotes: Quote[] = [ { parts: [{ t: "“We picked Northwind because setup was " }, { t: "refreshingly simple", em: true }, { t: " and the docs were clear. It " }, { t: "covers every need for our reporting stack", em: true }, { t: ".”" }], name: "Maya Lindqvist", company: "Kitefield", role: "CEO", from: "#34d399", to: "#065f46" }, { parts: [{ t: "“Northwind is dependable. The " }, { t: "scheduling engine", em: true }, { t: " just works, and it's the " }, { t: "most thoughtful tool we've adopted", em: true }, { t: " for planning and tracking work.”" }], name: "Theo Marchetti", company: "Altura", role: "CEO", from: "#60a5fa", to: "#1e3a8a" }, { parts: [{ t: "“Lumen plugs into Northwind " }, { t: "without any friction.", em: true }, { t: " If you ask the assistant to draft a workflow, it knows what it needs, " }, { t: "and you'll be guided to connect a workspace right there in the editor", em: true }, { t: ".”" }], name: "Priya Raman", company: "Lumen Labs", role: "CEO", from: "#a78bfa", to: "#312e81" }, { parts: [{ t: "“Northwind is the " }, { t: "missing layer for building modern web apps", em: true }, { t: " and has been " }, { t: "our default for a long while", em: true }, { t: ". Our team loves it and so do our users.”" }], name: "Jonas Berg", company: "Orchard", role: "CEO", from: "#fbbf24", to: "#78350f" }, ]; export default function EmphasisedQuoteCardRow({ quotes = defaultQuotes }: { quotes?: Quote[] }) { return ( <section className="bg-background px-4 py-12 sm:px-6"> <Stagger step={90} from="up" className="mx-auto grid max-w-[1088px] gap-4 sm:grid-cols-2 lg:grid-cols-4"> {quotes.map((q, i) => ( <figure key={i} className="relative flex min-h-[256px] flex-col justify-between rounded-xl border border-border bg-card p-5 transition-colors duration-emerald-hover-color ease-emerald-hover-color hover:border-border"> <blockquote className="font-sans text-[15px] leading-[22.5px] text-muted-foreground"> {q.parts.map((p, j) => ( <span key={j} className={p.em ? "text-foreground" : undefined}>{p.t}</span> ))} </blockquote> <figcaption className="mt-8 flex items-center gap-3"> <span aria-hidden className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-[12px] font-medium text-background" style={{ background: `linear-gradient(135deg, ${q.from}, ${q.to})` }}> {q.name.split(" ").map((n) => n[0]).join("")} </span> <span className="flex flex-col"> <span className="font-sans text-[15px] leading-5 text-muted-foreground">{q.name}</span> <span className="font-mono text-[13px] uppercase leading-[18px] text-muted-foreground">{q.company} – {q.role}</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: 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.