File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
src/stories/common/switch Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ import { useState } from 'react'
2+
3+ import { Meta , StoryFn } from '@storybook/react'
4+
5+ import { Switch } from '@/components/common/switch/Switch'
6+
7+ export default {
8+ title : 'Common/Switch/Switch' ,
9+ component : Switch ,
10+ parameters : {
11+ layout : 'centered' ,
12+ } ,
13+ argTypes : {
14+ label : { control : 'text' } ,
15+ isOn : { control : 'boolean' , table : { disable : true } } ,
16+ disabled : { control : 'boolean' } ,
17+ } ,
18+ } as Meta
19+
20+ const Template : StoryFn = args => {
21+ const [ isOn , setIsOn ] = useState < boolean > ( args . isOn || false )
22+
23+ const toggleSwitch = ( ) => setIsOn ( ( prev : boolean ) => ! prev )
24+
25+ return < Switch { ...args } isOn = { isOn } onToggle = { toggleSwitch } />
26+ }
27+
28+ export const Default = Template . bind ( { } )
29+ Default . args = {
30+ isOn : false ,
31+ label : '모집 중만 보기' ,
32+ disabled : false ,
33+ }
34+
35+ export const Disabled = Template . bind ( { } )
36+ Disabled . args = {
37+ isOn : false ,
38+ label : '모집 중만 보기' ,
39+ disabled : true ,
40+ }
You can’t perform that action at this time.
0 commit comments