Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: refactor Card, Label and Icon stories #1059

Merged
merged 4 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions src/components/Card/__stories__/Card.stories.scss

This file was deleted.

142 changes: 128 additions & 14 deletions src/components/Card/__stories__/Card.stories.tsx
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&lsquo;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',
};
18 changes: 0 additions & 18 deletions src/components/Card/__stories__/CardShowcase.scss

This file was deleted.

178 changes: 0 additions & 178 deletions src/components/Card/__stories__/CardShowcase.tsx

This file was deleted.

7 changes: 7 additions & 0 deletions src/components/Card/__stories__/Docs.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {Meta, Markdown} from '@storybook/addon-docs';
import * as Stories from './Card.stories';
import Readme from '../README.md?raw';

<Meta of={Stories} />

<Markdown>{Readme}</Markdown>
7 changes: 7 additions & 0 deletions src/components/Icon/__stories__/Docs.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {Meta, Markdown} from '@storybook/addon-docs';
import * as Stories from './Icon.stories';
import Readme from '../README.md?raw';

<Meta of={Stories} />

<Markdown>{Readme}</Markdown>
Loading