|
| 1 | +import { type Meta, type StoryObj } from '@storybook/react'; |
| 2 | +import React from 'react'; |
| 3 | +import { OdsCard, type OdsCardProp } from '../../../../ods-react/src/components/card/src'; |
| 4 | +import { CONTROL_CATEGORY } from '../../../src/constants/controls'; |
| 5 | +import { orderControls } from '../../../src/helpers/controls'; |
| 6 | + |
| 7 | +type Story = StoryObj<OdsCardProp>; |
| 8 | + |
| 9 | +const meta: Meta<OdsCardProp> = { |
| 10 | + component: OdsCard, |
| 11 | + // @ts-ignore see https://github.com/storybookjs/storybook/issues/27535 |
| 12 | + // subcomponents: { OdsCardXxx }, // Uncomment if sub components, otherwise remove |
| 13 | + title: 'ODS Components/Card', |
| 14 | +}; |
| 15 | + |
| 16 | +export default meta; |
| 17 | + |
| 18 | +export const Demo: Story = { |
| 19 | + argTypes: orderControls({ |
| 20 | + color: { |
| 21 | + table: { |
| 22 | + category: CONTROL_CATEGORY.design, |
| 23 | + defaultValue: { summary: 'primary' }, |
| 24 | + type: { summary: 'string' } |
| 25 | + }, |
| 26 | + control: 'select', |
| 27 | + options: ['primary', 'neutral'], |
| 28 | + }, |
| 29 | + children: { |
| 30 | + table: { |
| 31 | + category: CONTROL_CATEGORY.slot, |
| 32 | + defaultValue: { summary: 'ø' }, |
| 33 | + }, |
| 34 | + control: 'text', |
| 35 | + }, |
| 36 | + }), |
| 37 | + args: { |
| 38 | + color: 'primary', |
| 39 | + children: 'Hello, world!', |
| 40 | + }, |
| 41 | +}; |
| 42 | + |
| 43 | +export const Default: Story = { |
| 44 | + tags: ['!dev'], |
| 45 | + render: () => ( |
| 46 | + <OdsCard> |
| 47 | + <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<br />Interdum et malesuada fames ac ante ipsum primis in faucibus.</p> |
| 48 | + </OdsCard> |
| 49 | + ), |
| 50 | +}; |
| 51 | + |
| 52 | +export const Color: Story = { |
| 53 | + tags: ['!dev'], |
| 54 | + render: () => ( |
| 55 | + <div style={{ display: 'flex', gap: '16px' }}> |
| 56 | + <OdsCard color="primary"> |
| 57 | + <p>Primary Card</p> |
| 58 | + </OdsCard> |
| 59 | + <OdsCard color="neutral"> |
| 60 | + <p>Neutral Card</p> |
| 61 | + </OdsCard> |
| 62 | + </div> |
| 63 | + ), |
| 64 | +}; |
| 65 | + |
| 66 | +export const CustomCSS: Story = { |
| 67 | + tags: ['!dev'], |
| 68 | + render: () => ( |
| 69 | + <OdsCard style={{ width: '500px', display: 'flex', justifyContent: 'center', border: '3px solid green' }}> |
| 70 | + <p>Custom styled card</p> |
| 71 | + </OdsCard> |
| 72 | + ), |
| 73 | +}; |
0 commit comments