Hanging-Quote Testimonial Carousel
Left column has the 'Testimonials' label and a pair of circular hairline arrow buttons; right column holds a long semibold quote with a hanging opening quotation mark, followed by author name and role/company in black.
Rebuilt from thisislandscape.com/profile in the Gallery White Editorial style.
npx shadcn@latest add https://yoink-app.fly.dev/r/gallery-white-editorial/blocks/quote-carousel.json
Looks exactly like thisislandscape.com: brings its fonts and colours, namespaced so your own theme stays untouched.
npx shadcn@latest add https://yoink-app.fly.dev/r/gallery-white-editorial/mine/quote-carousel.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
Props: `label` (string) and `items` (array of {paragraphs: string[], name, role}). Arrow buttons cross-fade between quotes; renders standalone with defaults.
components/quote-carousel.tsx
"use client"; import { useEffect, useLayoutEffect, useRef, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useState } from "react"; type Item = { paragraphs: string[]; name: string; role: string }; const defaults: Item[] = [ { paragraphs: [ "Partnering with Northwind Studio changed how our small team shows up in the world. Our product is technical and dense, and we struggled to explain it plainly. They found a clear voice and a visual identity that feels calm, precise and confident. Prospects now tell us the site makes everything click before we even get on a call.", "The results arrived quickly. Inbound enquiries are better matched, sales conversations start further along, and visits to our site have grown several times over. The refreshed identity is also helping us win over experienced candidates.", ], name: "Maya Lindqvist", role: "Co-founder · Altura Labs", }, { paragraphs: [ "We came in with a crowded message and left with a sharp, memorable story. The team listened closely, challenged our assumptions and delivered a system we could actually run with across every channel.", "Within a quarter our launch pages were converting noticeably better and our partners began describing us in the exact words we had hoped for.", ], name: "Tomas Reyes", role: "CEO · Kitefield", }, ]; export default function HangingQuoteTestimonialCarousel({ label = "Testimonials", items = defaults, }: { label?: string; items?: Item[]; }) { const [i, setI] = useState(0); const [visible, setVisible] = useState(true); const go = (d: number) => { setVisible(false); setTimeout(() => { setI((p) => (p + d + items.length) % items.length); setVisible(true); }, 250); }; const it = items[i]; const btn = "flex h-8 w-8 items-center justify-center rounded-pill border border-ink/10 text-ink/40 transition-colors duration-pill-hover ease-pill-hover hover:border-ink hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-ink"; return ( <section className="border-t border-hairline bg-canvas px-4 py-10 font-sans text-ink md:py-14"> <Reveal from="none" duration={1000}> <div className="grid gap-10 md:grid-cols-2"> <div> <h2 className="text-h3 font-semibold">{label}</h2> <div className="mt-8 flex gap-1"> <button aria-label="Previous testimonial" onClick={() => go(-1)} className={btn}> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.2"><path d="M14 8H2M7 3L2 8l5 5" /></svg> </button> <button aria-label="Next testimonial" onClick={() => go(1)} className={btn}> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.2"><path d="M2 8h12M9 3l5 5-5 5" /></svg> </button> </div> </div> <figure className={`relative pl-[13px] transition-opacity duration-300 ${visible ? "opacity-100" : "opacity-0"}`} aria-live="polite" > <span aria-hidden className="absolute left-0 top-0 text-statement font-semibold">“</span> <blockquote className="space-y-5 text-statement font-semibold"> {it.paragraphs.map((p, k) => ( <p key={k}>{k === it.paragraphs.length - 1 ? p + "”" : p}</p> ))} </blockquote> <figcaption className="mt-20 text-statement font-semibold"> <div>{it.name}</div> <div>{it.role}</div> </figcaption> </figure> </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, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useState } from "react"; type Item = { paragraphs: string[]; name: string; role: string }; const defaults: Item[] = [ { paragraphs: [ "Partnering with Northwind Studio changed how our small team shows up in the world. Our product is technical and dense, and we struggled to explain it plainly. They found a clear voice and a visual identity that feels calm, precise and confident. Prospects now tell us the site makes everything click before we even get on a call.", "The results arrived quickly. Inbound enquiries are better matched, sales conversations start further along, and visits to our site have grown several times over. The refreshed identity is also helping us win over experienced candidates.", ], name: "Maya Lindqvist", role: "Co-founder · Altura Labs", }, { paragraphs: [ "We came in with a crowded message and left with a sharp, memorable story. The team listened closely, challenged our assumptions and delivered a system we could actually run with across every channel.", "Within a quarter our launch pages were converting noticeably better and our partners began describing us in the exact words we had hoped for.", ], name: "Tomas Reyes", role: "CEO · Kitefield", }, ]; export default function HangingQuoteTestimonialCarousel({ label = "Testimonials", items = defaults, }: { label?: string; items?: Item[]; }) { const [i, setI] = useState(0); const [visible, setVisible] = useState(true); const go = (d: number) => { setVisible(false); setTimeout(() => { setI((p) => (p + d + items.length) % items.length); setVisible(true); }, 250); }; const it = items[i]; const btn = "flex h-8 w-8 items-center justify-center rounded-full border border-foreground/10 text-foreground/40 transition-colors duration-gallery-pill-hover ease-gallery-pill-hover hover:border-foreground hover:text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-foreground"; return ( <section className="border-t border-border bg-background px-4 py-10 font-sans text-foreground md:py-14"> <Reveal from="none" duration={1000}> <div className="grid gap-10 md:grid-cols-2"> <div> <h2 className="text-gallery-h3 font-semibold">{label}</h2> <div className="mt-8 flex gap-1"> <button aria-label="Previous testimonial" onClick={() => go(-1)} className={btn}> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.2"><path d="M14 8H2M7 3L2 8l5 5" /></svg> </button> <button aria-label="Next testimonial" onClick={() => go(1)} className={btn}> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.2"><path d="M2 8h12M9 3l5 5-5 5" /></svg> </button> </div> </div> <figure className={`relative pl-[13px] transition-opacity duration-300 ${visible ? "opacity-100" : "opacity-0"}`} aria-live="polite" > <span aria-hidden className="absolute left-0 top-0 text-gallery-statement font-semibold">“</span> <blockquote className="space-y-5 text-gallery-statement font-semibold"> {it.paragraphs.map((p, k) => ( <p key={k}>{k === it.paragraphs.length - 1 ? p + "”" : p}</p> ))} </blockquote> <figcaption className="mt-20 text-gallery-statement font-semibold"> <div>{it.name}</div> <div>{it.role}</div> </figcaption> </figure> </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: not passedScrolls sideways at phone width (390px)
- 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.