import type { Meta, StoryObj } from "@storybook/react-vite"; import { CardLayout } from "./CardLayout"; import { HeadingField } from "../Heading/HeadingField"; import { RichTextDisplayField } from "../RichText/RichTextDisplayField"; import { TextItem } from "../RichText/TextItem"; import { ButtonWidget } from "../Button/ButtonWidget"; const meta = { title: "Components/Card", component: CardLayout, tags: ["autodocs"], parameters: { layout: "centered" }, argTypes: { shape: { control: "select", options: ["SQUARED", "SEMI_ROUNDED", "ROUNDED"], }, padding: { control: "select", options: ["NONE", "EVEN_LESS", "LESS", "STANDARD", "MORE", "EVEN_MORE"], }, style: { control: "select", options: [ "NONE", "ACCENT", "SUCCESS", "WARN", "ERROR", "INFO", "CHARCOAL_SCHEME", ], }, decorativeBarPosition: { control: "select", options: ["TOP", "START"] }, decorativeBarColor: { control: "select", options: ["ACCENT", "SUCCESS", "WARN", "ERROR", "INFO"], }, marginAbove: { control: "select", options: ["NONE", "EVEN_LESS", "LESS", "STANDARD", "MORE", "EVEN_MORE"], }, marginBelow: { control: "select", options: ["NONE", "EVEN_LESS", "LESS", "STANDARD", "MORE", "EVEN_MORE"], }, }, } satisfies Meta; export default meta; type Story = StoryObj; export const Default: Story = { args: { shape: "SEMI_ROUNDED", padding: "STANDARD", showBorder: true, children: (

Default Card

A standard card with border and semi-rounded corners.

), }, }; export const DecorativeBarTop: Story = { args: { shape: "SQUARED", padding: "STANDARD", showBorder: true, decorativeBarPosition: "TOP", decorativeBarColor: "ACCENT", borderColor: "#9191F8", children: (

Reference Information

This card uses a top decorative bar to indicate reference content.

), }, }; export const DecorativeBarStart: Story = { args: { shape: "SQUARED", padding: "STANDARD", showBorder: true, decorativeBarPosition: "START", decorativeBarColor: "WARN", borderColor: "#FFE47F", children: (

Warning

This card uses a start decorative bar.

), }, }; export const DecorativeBarColors: Story = { args: { children: null }, render: () => (

Accent bar

Success bar

Warn bar

Error bar

Info bar

), }; export const Shapes: Story = { args: { children: null }, render: () => (

Squared

0 radius

Semi Rounded

4px radius

Rounded

8px radius

), }; export const BorderOnly: Story = { args: { shape: "SEMI_ROUNDED", padding: "STANDARD", showBorder: true, showShadow: false, children: (

Border Only

No shadow

), }, }; export const ShadowOnly: Story = { args: { shape: "SEMI_ROUNDED", padding: "STANDARD", showBorder: false, showShadow: true, children: (

Shadow Only

No border

), }, }; export const BorderAndShadow: Story = { args: { shape: "SEMI_ROUNDED", padding: "STANDARD", showBorder: true, showShadow: true, children: (

Border and Shadow

Both border and shadow

), }, }; export const VerticalAlignment: Story = { args: { children: null }, parameters: { layout: "padded" }, render: () => (

Cards use flex flex-col internally. Put mt-auto on your footer element to pin it to the bottom when cards stretch to equal height.

{/* Food menu pattern */}

Variable content, footer pinned to bottom

]} marginBelow="NONE" className="[&>div]:leading-tight!" />
]} marginBelow="NONE" />
]} marginBelow="NONE" className="[&>div]:leading-tight!" />
$8.00
]} marginBelow="NONE" className="[&>div]:leading-tight!" />
$8.50
]} marginBelow="NONE" className="[&>div]:leading-tight!" />
$7.00
{/* Pricing pattern */}

Variable feature list, button at bottom

  • ✓ 5 projects
  • ✓ Basic analytics
  • ✓ Unlimited projects
  • ✓ Advanced analytics
  • ✓ Team collaboration
  • ✓ Priority support
  • ✓ Custom integrations
  • ✓ Everything in Pro
  • ✓ SSO & SAML
  • ✓ Dedicated support
), }; export const CardStyles: Story = { args: { children: null }, render: () => (

Accent

Success

Warn

Error

Info

Charcoal

Navy

Plum

), };