-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Select): 서브 컴포넌트 사용 케이스를 나누어 스토리북 작성 (#149)
- Loading branch information
1 parent
f80fe2a
commit bafb50f
Showing
6 changed files
with
484 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'docs': patch | ||
--- | ||
|
||
SelectV2 스토리북 작성 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
170 changes: 170 additions & 0 deletions
170
apps/docs/src/stories/SelectV2NoTriggerContent.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { SelectV2 } from '@sopt-makers/ui'; | ||
import { IconSend, IconDotsVertical } from '@sopt-makers/icons'; | ||
import { fn } from '@storybook/test'; | ||
|
||
const selectOptions = [ | ||
{ | ||
label: '수정', | ||
value: '', | ||
description: '수정', | ||
icon: <IconSend />, | ||
}, | ||
{ | ||
label: '삭제', | ||
value: 'option1', | ||
description: '삭제', | ||
icon: <IconSend />, | ||
}, | ||
]; | ||
|
||
const userOptions = [ | ||
{ | ||
label: '수정', | ||
value: 1, | ||
description: '수정', | ||
}, | ||
{ | ||
label: '삭제', | ||
value: 2, | ||
description: '삭제', | ||
}, | ||
]; | ||
|
||
const style = { width: 24, height: 24, color: 'white' }; | ||
|
||
const meta: Meta<typeof SelectV2.Root> = { | ||
title: 'Components/Input/SelectV2/NoTriggerContent', | ||
component: SelectV2.Root, | ||
tags: ['autodocs'], | ||
args: { | ||
visibleOptions: 3, | ||
onChange: fn(), | ||
}, | ||
argTypes: { | ||
defaultValue: { control: 'select', options: ['', 'option1', 'option2', 'option3', 'option4', 'option5'] }, | ||
visibleOptions: { control: 'number' }, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Text: StoryObj<typeof SelectV2.Root> = { | ||
render: (args) => ( | ||
<SelectV2.Root {...args}> | ||
<SelectV2.Trigger> | ||
<div> | ||
<IconDotsVertical style={style} /> | ||
</div> | ||
</SelectV2.Trigger> | ||
<SelectV2.Menu> | ||
{selectOptions.map((option) => ( | ||
<SelectV2.MenuItem key={option.value} option={option} /> | ||
))} | ||
</SelectV2.Menu> | ||
</SelectV2.Root> | ||
), | ||
args: { | ||
type: 'text', | ||
visibleOptions: 3, | ||
}, | ||
argTypes: { | ||
type: { control: 'radio', options: ['text', 'textDesc', 'textIcon'] }, | ||
}, | ||
}; | ||
|
||
export const TextDesc: StoryObj<typeof SelectV2.Root> = { | ||
render: (args) => ( | ||
<SelectV2.Root {...args}> | ||
<SelectV2.Trigger> | ||
<div> | ||
<IconDotsVertical style={style} /> | ||
</div> | ||
</SelectV2.Trigger> | ||
<SelectV2.Menu> | ||
{selectOptions.map((option) => ( | ||
<SelectV2.MenuItem key={option.value} option={option} /> | ||
))} | ||
</SelectV2.Menu> | ||
</SelectV2.Root> | ||
), | ||
args: { | ||
type: 'textDesc', | ||
visibleOptions: 3, | ||
}, | ||
argTypes: { | ||
type: { control: 'radio', options: ['text', 'textDesc', 'textIcon'] }, | ||
}, | ||
}; | ||
|
||
export const TextIcon: StoryObj<typeof SelectV2.Root> = { | ||
render: (args) => ( | ||
<SelectV2.Root {...args}> | ||
<SelectV2.Trigger> | ||
<div> | ||
<IconDotsVertical style={style} /> | ||
</div> | ||
</SelectV2.Trigger> | ||
<SelectV2.Menu> | ||
{selectOptions.map((option) => ( | ||
<SelectV2.MenuItem key={option.value} option={option} /> | ||
))} | ||
</SelectV2.Menu> | ||
</SelectV2.Root> | ||
), | ||
args: { | ||
type: 'textIcon', | ||
visibleOptions: 3, | ||
}, | ||
argTypes: { | ||
type: { control: 'radio', options: ['text', 'textDesc', 'textIcon'] }, | ||
}, | ||
}; | ||
|
||
export const UserList: StoryObj<typeof SelectV2.Root> = { | ||
render: (args) => ( | ||
<SelectV2.Root {...args}> | ||
<SelectV2.Trigger> | ||
<div> | ||
<IconDotsVertical style={style} /> | ||
</div> | ||
</SelectV2.Trigger> | ||
<SelectV2.Menu> | ||
{userOptions.map((option) => ( | ||
<SelectV2.MenuItem key={option.value} option={option} /> | ||
))} | ||
</SelectV2.Menu> | ||
</SelectV2.Root> | ||
), | ||
args: { | ||
type: 'userList', | ||
visibleOptions: 3, | ||
}, | ||
argTypes: { | ||
type: { control: 'radio', options: ['userList', 'userListDesc'] }, | ||
}, | ||
}; | ||
|
||
export const UserListDesc: StoryObj<typeof SelectV2.Root> = { | ||
render: (args) => ( | ||
<SelectV2.Root {...args}> | ||
<SelectV2.Trigger> | ||
<div> | ||
<IconDotsVertical style={style} /> | ||
</div> | ||
</SelectV2.Trigger> | ||
<SelectV2.Menu> | ||
{userOptions.map((option) => ( | ||
<SelectV2.MenuItem key={option.value} option={option} /> | ||
))} | ||
</SelectV2.Menu> | ||
</SelectV2.Root> | ||
), | ||
args: { | ||
type: 'userListDesc', | ||
visibleOptions: 3, | ||
}, | ||
argTypes: { | ||
type: { control: 'radio', options: ['userList', 'userListDesc'] }, | ||
}, | ||
}; |
Oops, something went wrong.