|
| 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 | +}; |
0 commit comments