import type { Meta, StoryObj } from '@storybook/react-vite' import { ArrowRight, ArrowUpRight, BookOpen, MapPin, MoreHorizontal, TrendingUp, Users } from 'lucide-react' import { fn } from 'storybook/test' import { Avatar, AvatarGroup } from './Avatar' import { Badge } from './Badge' import { Button, IconButton } from './Button' import { Card } from './Card' import { CARD_LAYOUTS, CARD_PADDINGS, CARD_VARIANTS } from './card.tokens' import { PORTRAITS, landscape } from './display.fixtures' const meta = { title: 'Layout/Card', component: Card, subcomponents: { 'Card.Header': Card.Header, 'Card.Title': Card.Title, 'Card.Description': Card.Description, 'Card.Body': Card.Body, 'Card.Footer': Card.Footer, 'Card.Media': Card.Media, }, tags: ['autodocs'], parameters: { docs: { description: { component: 'A surface that groups related content. Compose `Card.Media`, `Card.Header` (with `Card.Title`, `Card.Description` and an optional `action`), `Card.Body` and `Card.Footer`; the card spaces them by `padding`. `layout="horizontal"` puts the media beside the text. Pass `href` (or `render={ ), } export const Variants: Story = { render: (args) => (
{CARD_VARIANTS.map((variant) => ( {title(variant)} {variant === 'outline' ? 'A bordered surface for most content.' : variant === 'elevated' ? 'A soft shadow lifts it off the page.' : 'A quiet fill for secondary content.'} Cards group related content and actions about a single subject. ))}
), } export const Padding: Story = { render: (args) => (
{CARD_PADDINGS.map((padding) => ( padding="{padding}" Spacing shared by every section. ))}
), } export const ProfileCard: Story = { render: (args) => ( } onClick={fn()} />} >
Jane Doe Senior Product Engineer
Engineering Full-time Available

), } export const StatCards: Story = { parameters: { docs: { description: { story: 'Compact stat cards in a dashboard row.' } } }, render: (args) => (
{[ { label: 'Active employees', value: '1,284', delta: '+4.2%', note: 'vs last month', color: 'success' as const, icon: Users }, { label: 'Open positions', value: '37', delta: '+6', note: 'across 9 teams', color: 'info' as const, icon: TrendingUp }, { label: 'Attrition (12 mo)', value: '8.1%', delta: '+0.6 pts', note: 'above target', color: 'warning' as const, icon: ArrowUpRight }, ].map((s) => ( {s.delta} {s.note} ))}
), } export const HorizontalMedia: Story = { args: { layout: 'horizontal' }, render: (args) => ( Illustration of blue hills under a pale sky Offsite Team offsite in the Sintra hills 12–14 November · 24 attending Three days of planning, workshops and long walks. Travel and accommodation are booked; bring layers, the evenings get cold. ), } export const VerticalMedia: Story = { render: (args) => (
{[ { t: 'Designing for dark mode', d: 'Five rules for surfaces, borders and text that hold up at night.', sky: '#fde68a', hills: '#d97706', tag: 'Guide' }, { t: 'Accessible data tables', d: 'Captions, header scopes and sort state that screen readers announce.', sky: '#a7f3d0', hills: '#047857', tag: 'Article' }, ].map((p) => ( {p.t} {p.d} {p.tag} 6 min read ))}
), } export const InteractiveLink: Story = { parameters: { docs: { description: { story: 'With `href` the whole card is one link: it lifts on hover and shows a focus ring. Keep other interactive elements out of a link card. `render={