|
| 1 | +import React, { useState } from 'react' |
| 2 | + |
| 3 | +import { Meta, StoryFn } from '@storybook/react' |
| 4 | + |
| 5 | +import { Select } from '@/components/shared/select' |
| 6 | + |
| 7 | +export default { |
| 8 | + title: 'Components/Common/Select', |
| 9 | + component: Select, |
| 10 | + parameters: { |
| 11 | + layout: 'centered', |
| 12 | + }, |
| 13 | +} as Meta |
| 14 | + |
| 15 | +const Template: StoryFn<typeof Select> = args => { |
| 16 | + const [value, setValue] = useState(args.value) |
| 17 | + return <Select {...args} value={value} onChange={setValue} /> |
| 18 | +} |
| 19 | + |
| 20 | +export const Default = Template.bind({}) |
| 21 | +Default.args = { |
| 22 | + options: [ |
| 23 | + { label: '스터디', value: '스터디' }, |
| 24 | + { label: '팀 프로젝트', value: '팀 프로젝트' }, |
| 25 | + { label: '멘토링', value: '멘토링' }, |
| 26 | + ], |
| 27 | + value: '', |
| 28 | + placeholder: '모집 유형 선택', |
| 29 | + disabled: false, |
| 30 | +} |
| 31 | + |
| 32 | +export const WithPreSelectedValue = Template.bind({}) |
| 33 | +WithPreSelectedValue.args = { |
| 34 | + options: [ |
| 35 | + { label: 'Option 1', value: 'option1' }, |
| 36 | + { label: 'Option 2', value: 'option2' }, |
| 37 | + { label: 'Option 3', value: 'option3' }, |
| 38 | + ], |
| 39 | + value: 'option2', |
| 40 | + placeholder: 'Select an option', |
| 41 | + disabled: false, |
| 42 | +} |
| 43 | + |
| 44 | +export const Disabled = Template.bind({}) |
| 45 | +Disabled.args = { |
| 46 | + options: [ |
| 47 | + { label: 'Option 1', value: 'option1' }, |
| 48 | + { label: 'Option 2', value: 'option2' }, |
| 49 | + { label: 'Option 3', value: 'option3' }, |
| 50 | + ], |
| 51 | + value: '', |
| 52 | + placeholder: 'Select an option', |
| 53 | + disabled: true, |
| 54 | +} |
0 commit comments