import { BADGE } from '@geometricpanda/storybook-addon-badges'; import type { Meta, StoryObj } from '@storybook/react'; import React from 'react'; import { Icon } from '@components/components/Icon'; import { GridList } from '@src/alchemy-components/.docs/mdx-components'; import { colors } from '@src/alchemy-components/theme'; import { Card, cardDefaults } from '.'; // Auto Docs const meta = { title: 'Components / Card', component: Card, // Display Properties parameters: { layout: 'centered', badges: [BADGE.STABLE, 'readyForDesignReview'], docs: { subtitle: 'Used to render a card.', }, }, // Component-level argTypes argTypes: { title: { description: 'The title of the card', table: { defaultValue: { summary: `${cardDefaults.title}` }, }, control: { type: 'text', }, }, subTitle: { description: 'The subtitle of the card', control: { type: 'text', }, }, icon: { description: 'The icon on the card', control: { type: 'text', }, }, iconAlignment: { description: 'Whether the alignment of icon is horizontal or vertical', table: { defaultValue: { summary: `${cardDefaults.iconAlignment}` }, }, control: { type: 'select', }, }, percent: { description: 'The percent value on the pill of the card', control: { type: 'number', }, }, button: { description: 'The button on the card', control: { type: 'text', }, }, width: { description: 'The width of the card', control: { type: 'text', }, }, maxWidth: { description: 'The maximum width of the card', control: { type: 'text', }, }, height: { description: 'The height of the card', control: { type: 'text', }, }, onClick: { description: 'The on click function for the card', }, isEmpty: { description: 'Whether the card is in empty state with No data', table: { defaultValue: { summary: `${cardDefaults.isEmpty}` }, }, control: { type: 'boolean', }, }, }, // Define default args args: { title: 'Title', subTitle: 'Subtitle', iconAlignment: 'horizontal', isEmpty: false, }, } satisfies Meta; export default meta; // Stories type Story = StoryObj; // Basic story is what is displayed 1st in storybook // Pass props to this so that it can be customized via the UI props panel export const sandbox: Story = { tags: ['dev'], render: (props) => , }; export const withChildren = () => (
Children of the card (Swap me)
); export const withoutSubtitle = () => (
Children of the card (Swap me)
); export const withIcon = () => ( } /> } iconAlignment="vertical" /> ); export const withButton = () => ( } onClick={() => window.alert('Card clicked')} /> ); export const withPercentPill = () => ; export const withAllTheElements = () => ( } button={} onClick={() => window.alert('Card clicked')} >
Children of the card (Swap me)
);