Skip to content

Commit

Permalink
docs(storybook): add stories for Card, Flex, Input components
Browse files Browse the repository at this point in the history
  • Loading branch information
kang-kibong committed Sep 23, 2024
1 parent 7b6ab68 commit e0e1cc4
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ function App() {
return (
<>
<GlobalStyles />
<h1>hello world!</h1>
</>
);
}
Expand Down
24 changes: 24 additions & 0 deletions src/components/common/Card/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Meta, StoryObj } from '@storybook/react';
import Card from '.';

const meta: Meta<typeof Card> = {
title: 'common/Card',
component: Card,
tags: ['autodocs'],
};

export default meta;

type Story = StoryObj<typeof Card>;

export const Default: Story = {
args: {
borderRadius: '12px',
children: <h1>Hello World!</h1>,
},
render: (args) => (
<Card {...args} css={{ padding: '12px 24px' }}>
<h1>Hello World!</h1>
</Card>
),
};
38 changes: 38 additions & 0 deletions src/components/common/Flex/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Meta, StoryObj } from '@storybook/react';
import Flex from '.';

const meta: Meta<typeof Flex> = {
title: 'common/Flex',
component: Flex,
tags: ['autodocs'],
};

export default meta;

type Story = StoryObj<typeof Flex>;

export const Default: Story = {
args: {
direction: 'row',
justifyContent: 'center',
alignItems: 'center',
xGap: '10px',
yGap: '10px',
},
render: (args) => (
<Flex {...args}>
<div style={boxStyle}>Box 1</div>
<div style={boxStyle}>Box 2</div>
<div style={boxStyle}>Box 3</div>
</Flex>
),
};

const boxStyle = {
width: '100px',
height: '100px',
backgroundColor: 'lightblue',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
};
20 changes: 20 additions & 0 deletions src/components/common/Input/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Meta, StoryObj } from '@storybook/react';
import Input from '.';

const meta: Meta<typeof Input> = {
title: 'common/Input',
component: Input,
tags: ['autodocs'],
};

export default meta;

type Story = StoryObj<typeof Input>;

export const Default: Story = {
args: {
label: '์•„์ด๋””',
placeholder: '์•„์ด๋””๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.',
},
render: (args) => <Input {...args} css={{ padding: '12px' }} />,
};

0 comments on commit e0e1cc4

Please sign in to comment.