Skip to content

Commit c50eaf4

Browse files
committed
docs(react-toggle-list): add storybook docs
1 parent d320b30 commit c50eaf4

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

stories/ToggleList.stories.tsx

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import React from 'react';
2+
import type { Meta, StoryObj } from '@storybook/react';
3+
import { ReactToggleList } from '../packages/react-toggle-list/dist/react-toggle-list.cjs.js';
4+
5+
const meta = {
6+
title: 'Example/ReactToggleList',
7+
component: ReactToggleList,
8+
parameters: {},
9+
tags: ['autodocs'],
10+
argTypes: {},
11+
} satisfies Meta<typeof ReactToggleList>;
12+
13+
export default meta;
14+
type Story = StoryObj<typeof meta>;
15+
16+
const List = {
17+
title: '토글토글',
18+
subItems: [
19+
<p onClick={() => alert('T')}>T</p>,
20+
<p onClick={() => alert('E')}>E</p>,
21+
<p onClick={() => alert('S')}>S</p>,
22+
<p onClick={() => alert('T')}>T</p>,
23+
],
24+
};
25+
26+
const nestedList = {
27+
title: '네스팅 토글토글',
28+
subItems: [
29+
<p onClick={() => alert('T')}>T</p>,
30+
<p onClick={() => alert('E')}>E</p>,
31+
<p onClick={() => alert('S')}>S</p>,
32+
<p onClick={() => alert('T')}>T</p>,
33+
<ReactToggleList items={List} />,
34+
],
35+
};
36+
const nestedNestedList = {
37+
title: '네스티드 네스팅 토글토글',
38+
subItems: [
39+
<p onClick={() => alert('T')}>T</p>,
40+
<p onClick={() => alert('E')}>E</p>,
41+
<p onClick={() => alert('S')}>S</p>,
42+
<p onClick={() => alert('T')}>T</p>,
43+
<ReactToggleList items={nestedList} />,
44+
],
45+
};
46+
47+
export const Default: Story = {
48+
args: {
49+
items: List,
50+
},
51+
};
52+
53+
export const Nested: Story = {
54+
args: {
55+
items: nestedList,
56+
},
57+
};
58+
59+
export const NestedNested: Story = {
60+
args: {
61+
items: nestedNestedList,
62+
},
63+
};

tailwind.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/** @type {import('tailwindcss').Config} */
2+
module.exports = {
3+
content: [
4+
"./packages/**/*.{js,ts,jsx,tsx,mdx}",
5+
],
6+
theme: {
7+
extend: {
8+
colors: {
9+
primary: "#fb9a6a",
10+
}
11+
},
12+
},
13+
plugins: [],
14+
}
15+

0 commit comments

Comments
 (0)