-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: refactor Card, Label and Icon stories (#1059)
- Loading branch information
Showing
14 changed files
with
285 additions
and
429 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,139 @@ | ||
import React from 'react'; | ||
|
||
import type {Meta, StoryFn} from '@storybook/react'; | ||
import type {Meta, StoryObj} from '@storybook/react'; | ||
|
||
import {Showcase} from '../../../demo/Showcase'; | ||
import {Card} from '../Card'; | ||
import type {CardProps} from '../Card'; | ||
|
||
import {CardShowcase} from './CardShowcase'; | ||
|
||
import './Card.stories.scss'; | ||
|
||
export default { | ||
title: 'Components/Data Display/Card', | ||
component: Card, | ||
} as Meta; | ||
|
||
const DefaultTemplate: StoryFn<CardProps> = (args) => ( | ||
<Card {...args} className="card-stories"> | ||
<div className="card-content-stories">card‘s content</div> | ||
</Card> | ||
); | ||
export const Default = DefaultTemplate.bind({}); | ||
type Story = StoryObj<typeof Card>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
children: 'Content', | ||
style: { | ||
width: 120, | ||
height: 120, | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}, | ||
}, | ||
}; | ||
|
||
export const Size: Story = { | ||
render: (args) => ( | ||
<Showcase> | ||
<Card {...args} size="m"> | ||
Size m | ||
</Card> | ||
<Card {...args} size="l"> | ||
Size l | ||
</Card> | ||
</Showcase> | ||
), | ||
args: { | ||
...Default.args, | ||
}, | ||
}; | ||
|
||
export const Theme: Story = { | ||
render: (args) => ( | ||
<Showcase> | ||
<Card {...args} view="outlined" theme="normal"> | ||
Normal | ||
</Card> | ||
<Card {...args} view="outlined" theme="info"> | ||
Info | ||
</Card> | ||
<Card {...args} view="outlined" theme="success"> | ||
Success | ||
</Card> | ||
<Card {...args} view="outlined" theme="warning"> | ||
Warning | ||
</Card> | ||
<Card {...args} view="outlined" theme="danger"> | ||
Danger | ||
</Card> | ||
<Card {...args} view="filled" theme="normal"> | ||
Normal | ||
</Card> | ||
<Card {...args} view="filled" theme="info"> | ||
Info | ||
</Card> | ||
<Card {...args} view="filled" theme="success"> | ||
Success | ||
</Card> | ||
<Card {...args} view="filled" theme="warning"> | ||
Warning | ||
</Card> | ||
<Card {...args} view="filled" theme="danger"> | ||
Danger | ||
</Card> | ||
</Showcase> | ||
), | ||
args: { | ||
...Default.args, | ||
}, | ||
}; | ||
|
||
export const View: Story = { | ||
render: (args) => ( | ||
<Showcase> | ||
<Card {...args} view="clear"> | ||
Clear | ||
</Card> | ||
<Card {...args} view="outlined"> | ||
Outlined | ||
</Card> | ||
<Card {...args} view="filled"> | ||
Filled | ||
</Card> | ||
<Card {...args} view="raised"> | ||
Raised | ||
</Card> | ||
</Showcase> | ||
), | ||
args: { | ||
...Default.args, | ||
}, | ||
}; | ||
|
||
export const ActionType: Story = { | ||
render: (args) => ( | ||
<Showcase> | ||
<Card {...args}>Default</Card> | ||
<Card {...args} disabled> | ||
Disabled | ||
</Card> | ||
</Showcase> | ||
), | ||
args: { | ||
...Default.args, | ||
type: 'action', | ||
}, | ||
name: 'Action Type', | ||
}; | ||
|
||
const ShowcaseTemplate: StoryFn<CardProps> = () => <CardShowcase />; | ||
export const Showcase = ShowcaseTemplate.bind({}); | ||
export const SelectionType: Story = { | ||
render: (args) => ( | ||
<Showcase> | ||
<Card {...args}>Default</Card> | ||
<Card {...args} selected> | ||
Selected | ||
</Card> | ||
<Card {...args} disabled> | ||
Disabled | ||
</Card> | ||
</Showcase> | ||
), | ||
args: { | ||
...Default.args, | ||
type: 'selection', | ||
}, | ||
name: 'Selection Type', | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.