Portrait Story Carousel
Row of 3:4 rounded image cards with colorful abstract artwork and a white logo at the bottom, each with a two-line caption and purple arrow link beneath. Previous and next square icon buttons sit top right.
Rebuilt from stripe.com in the Iridescent Ledger style.
npx shadcn@latest add https://justyoink.it/r/iridescent-ledger/blocks/story-card-carousel.json
Looks exactly like stripe.com: brings its fonts and colours, namespaced so your own theme stays untouched.
npx shadcn@latest add https://justyoink.it/r/iridescent-ledger/mine/story-card-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
Pass heading, intro, ctaLabel and a stories array (name, caption, link, from/to gradient colors, shape 0-3). Previous/next buttons shift the track by one card over 350ms.
components/story-card-carousel.tsx
import { useState } from "react"; type Story = { name: string; caption: string; link: string; from: string; to: string; shape: number }; const defaultStories: Story[] = [ { name: "Orbital", caption: "Orbital doubles its weekly order volume while keeping payouts steady.", link: "Read Orbital's story", from: "#0b1030", to: "#7a2cf0", shape: 0 }, { name: "Kitefield", caption: "Kitefield reaches forty markets with one unified checkout flow.", link: "Read Kitefield's story", from: "#0a2a6b", to: "#f0558f", shape: 1 }, { name: "Altura", caption: "Altura trims reconciliation time from days to minutes for its teams.", link: "Read Altura's story", from: "#1c4a55", to: "#8fb5b8", shape: 2 }, { name: "Northwind", caption: "Northwind launches subscriptions in a single sprint across regions.", link: "Read Northwind's story", from: "#101418", to: "#1fa37a", shape: 3 }, { name: "Lumen", caption: "Lumen automates invoicing for thousands of small studios worldwide.", link: "Read Lumen's story", from: "#2a1050", to: "#ff7a1a", shape: 0 }, ]; function Art({ shape }: { shape: number }) { return ( <svg viewBox="0 0 200 200" className="h-40 w-40" aria-hidden="true"> {shape === 0 && [0, 1, 2, 3, 4].map((i) => (<circle key={i} cx={100 + 55 * Math.cos((i * 2 * Math.PI) / 5)} cy={100 + 55 * Math.sin((i * 2 * Math.PI) / 5)} r="26" fill="#f72df3" opacity="0.7" />))} {shape === 1 && <><circle cx="100" cy="80" r="40" fill="#ffb08a" /><rect x="50" y="120" width="100" height="70" rx="35" fill="#c96bd8" /></>} {shape === 2 && <rect x="50" y="50" width="100" height="100" rx="50" fill="none" stroke="#fff" strokeWidth="16" />} {shape === 3 && <><path d="M100 20 L170 110 L100 110 Z" fill="#3ddc97" /><path d="M100 190 L30 100 L100 100 Z" fill="#3ddc97" opacity="0.8" /></>} </svg> ); } export default function PortraitStoryCarousel({ heading = "Grow on a platform that scales with every new market you enter", intro = "Teams of every size lean on our tools to launch quickly, accept payments anywhere and keep their books tidy.", ctaLabel = "Explore for founders", stories = defaultStories, }: { heading?: string; intro?: string; ctaLabel?: string; stories?: Story[] }) { const [index, setIndex] = useState(0); const max = stories.length - 1; return ( <section className="bg-canvas text-ink font-sans py-12"> <div className="mx-auto max-w-[1264px] px-4"> <div className="grid gap-6 md:grid-cols-2"> <div> <h2 className="text-h2 text-ink-deep max-w-md">{heading}</h2> <a href="#" className="mt-6 inline-flex h-12 items-center bg-accent px-6 text-ui text-white rounded-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent">{ctaLabel} ›</a> </div> <p className="text-lead text-ink-muted">{intro}</p> </div> <div className="mt-8 flex justify-end gap-3"> <button aria-label="Previous" disabled={index === 0} onClick={() => setIndex((i) => Math.max(0, i - 1))} className="h-10 w-10 rounded-sm border border-hairline bg-surface text-accent disabled:opacity-50 duration-link ease-link">←</button> <button aria-label="Next" disabled={index === max} onClick={() => setIndex((i) => Math.min(max, i + 1))} className="h-10 w-10 rounded-sm bg-accent-wash text-accent border border-accent-soft disabled:opacity-50 duration-link ease-link">→</button> </div> <div className="mt-8 overflow-hidden"> <ul className="flex gap-6 transition-transform duration-[350ms] ease-in-out" style={{ transform: `translateX(calc(${-index} * (min(332px, 75vw) + 24px)))` }}> {stories.map((s) => ( <li key={s.name} className="w-[min(332px,75vw)] shrink-0"> <div className="relative flex aspect-[3/4] items-center justify-center overflow-hidden rounded-md" style={{ background: `linear-gradient(160deg, ${s.from}, ${s.to})` }}> <Art shape={s.shape} /> <span className="absolute bottom-5 left-5 text-lg font-semibold text-white">{s.name}</span> </div> <p className="mt-4 text-ui text-ink max-w-[16rem]">{s.caption}</p> <a href="#" className="mt-3 inline-block text-ui text-accent hover:text-accent-soft duration-link ease-link">{s.link} ›</a> </li> ))} </ul> </div> <div className="mt-12 grid gap-6 md:grid-cols-2"> {[{ t: "Founder program.", d: "Credits, mentors and a friendly community to help your venture take off.", l: "Join today", g: "linear-gradient(135deg,#f72df3,#533afd)" }, { t: "Launch kit.", d: "Register your company and open accounts together in just a few days.", l: "Begin setup", g: "linear-gradient(135deg,#ffad00,#ff7600)" }].map((c) => ( <div key={c.t} className="relative overflow-hidden rounded-sm border border-hairline bg-surface p-6"> <div className="absolute -right-10 top-0 h-full w-40 opacity-90" style={{ background: c.g, clipPath: "polygon(40% 0,100% 0,100% 100%,0 100%)" }} /> <p className="relative max-w-xs text-ui text-ink-muted"><strong className="text-ink-deep">{c.t}</strong> {c.d}</p> <a href="#" className="relative mt-4 inline-block text-ui text-accent">{c.l} ›</a> </div> ))} </div> </div> </section> ); }import { useState } from "react"; type Story = { name: string; caption: string; link: string; from: string; to: string; shape: number }; const defaultStories: Story[] = [ { name: "Orbital", caption: "Orbital doubles its weekly order volume while keeping payouts steady.", link: "Read Orbital's story", from: "#0b1030", to: "#7a2cf0", shape: 0 }, { name: "Kitefield", caption: "Kitefield reaches forty markets with one unified checkout flow.", link: "Read Kitefield's story", from: "#0a2a6b", to: "#f0558f", shape: 1 }, { name: "Altura", caption: "Altura trims reconciliation time from days to minutes for its teams.", link: "Read Altura's story", from: "#1c4a55", to: "#8fb5b8", shape: 2 }, { name: "Northwind", caption: "Northwind launches subscriptions in a single sprint across regions.", link: "Read Northwind's story", from: "#101418", to: "#1fa37a", shape: 3 }, { name: "Lumen", caption: "Lumen automates invoicing for thousands of small studios worldwide.", link: "Read Lumen's story", from: "#2a1050", to: "#ff7a1a", shape: 0 }, ]; function Art({ shape }: { shape: number }) { return ( <svg viewBox="0 0 200 200" className="h-40 w-40" aria-hidden="true"> {shape === 0 && [0, 1, 2, 3, 4].map((i) => (<circle key={i} cx={100 + 55 * Math.cos((i * 2 * Math.PI) / 5)} cy={100 + 55 * Math.sin((i * 2 * Math.PI) / 5)} r="26" fill="#f72df3" opacity="0.7" />))} {shape === 1 && <><circle cx="100" cy="80" r="40" fill="#ffb08a" /><rect x="50" y="120" width="100" height="70" rx="35" fill="#c96bd8" /></>} {shape === 2 && <rect x="50" y="50" width="100" height="100" rx="50" fill="none" stroke="var(--color-card)" strokeWidth="16" />} {shape === 3 && <><path d="M100 20 L170 110 L100 110 Z" fill="#3ddc97" /><path d="M100 190 L30 100 L100 100 Z" fill="#3ddc97" opacity="0.8" /></>} </svg> ); } export default function PortraitStoryCarousel({ heading = "Grow on a platform that scales with every new market you enter", intro = "Teams of every size lean on our tools to launch quickly, accept payments anywhere and keep their books tidy.", ctaLabel = "Explore for founders", stories = defaultStories, }: { heading?: string; intro?: string; ctaLabel?: string; stories?: Story[] }) { const [index, setIndex] = useState(0); const max = stories.length - 1; return ( <section className="bg-background text-foreground font-sans py-12"> <div className="mx-auto max-w-[1264px] px-4"> <div className="grid gap-6 md:grid-cols-2"> <div> <h2 className="text-iridescent-h2 text-muted-foreground max-w-md">{heading}</h2> <a href="#" className="mt-6 inline-flex h-12 items-center bg-primary px-6 text-iridescent-ui text-primary-foreground rounded-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary">{ctaLabel} ›</a> </div> <p className="text-iridescent-lead text-muted-foreground">{intro}</p> </div> <div className="mt-8 flex justify-end gap-3"> <button aria-label="Previous" disabled={index === 0} onClick={() => setIndex((i) => Math.max(0, i - 1))} className="h-10 w-10 rounded-sm border border-border bg-card text-primary disabled:opacity-50 duration-iridescent-link ease-iridescent-link">←</button> <button aria-label="Next" disabled={index === max} onClick={() => setIndex((i) => Math.min(max, i + 1))} className="h-10 w-10 rounded-sm bg-primary/10 text-primary border border-iridescent-accent-soft disabled:opacity-50 duration-iridescent-link ease-iridescent-link">→</button> </div> <div className="mt-8 overflow-hidden"> <ul className="flex gap-6 transition-transform duration-[350ms] ease-in-out" style={{ transform: `translateX(calc(${-index} * (min(332px, 75vw) + 24px)))` }}> {stories.map((s) => ( <li key={s.name} className="w-[min(332px,75vw)] shrink-0"> <div className="relative flex aspect-[3/4] items-center justify-center overflow-hidden rounded-md" style={{ background: `linear-gradient(160deg, ${s.from}, ${s.to})` }}> <Art shape={s.shape} /> <span className="absolute bottom-5 left-5 text-lg font-semibold text-background">{s.name}</span> </div> <p className="mt-4 text-iridescent-ui text-foreground max-w-[16rem]">{s.caption}</p> <a href="#" className="mt-3 inline-block text-iridescent-ui text-primary hover:text-iridescent-accent-soft duration-iridescent-link ease-iridescent-link">{s.link} ›</a> </li> ))} </ul> </div> <div className="mt-12 grid gap-6 md:grid-cols-2"> {[{ t: "Founder program.", d: "Credits, mentors and a friendly community to help your venture take off.", l: "Join today", g: "linear-gradient(135deg,#f72df3,#533afd)" }, { t: "Launch kit.", d: "Register your company and open accounts together in just a few days.", l: "Begin setup", g: "linear-gradient(135deg,#ffad00,#ff7600)" }].map((c) => ( <div key={c.t} className="relative overflow-hidden rounded-sm border border-border bg-card p-6"> <div className="absolute -right-10 top-0 h-full w-40 opacity-90" style={{ background: c.g, clipPath: "polygon(40% 0,100% 0,100% 100%,0 100%)" }} /> <p className="relative max-w-xs text-iridescent-ui text-muted-foreground"><strong className="text-muted-foreground">{c.t}</strong> {c.d}</p> <a href="#" className="relative mt-4 inline-block text-iridescent-ui text-primary">{c.l} ›</a> </div> ))} </div> </div> </section> ); }
Quality checks
Automated, in a real browser · 5d 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: not passed4 hard-coded colours (#f72df3, #ffb08a, #c96bd8, #3ddc97). These ignore the theme and break dark mode.
- Animates cleanly: doesn't applyDoesn't animate, so there's nothing to check.