-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Select): 서브 컴포넌트 사용 케이스를 나누어 스토리북 작성 #149
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c46296e
chore: SelectV2 스토리 작성을 위해 @sopt-makers/ui 2.3.0 버전으로 변경
suwonthugger 6b1a7fe
feat(Select): 기존 Select 컴포넌트 스토리 title deprecated/select로 수정
suwonthugger 4f02cba
feat(Select): TriggerContent의 유무에 따라서 SelectV2 스토리 작성
suwonthugger 86eb915
fix(Select): 잘못 삽입된 아이콘 코드 삭제
suwonthugger 42001a8
add changesets
suwonthugger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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> | ||
Comment on lines
+56
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TriggerContent를 쓰지 않는 케이스의 경우, Trigger의 자식요소로 mds 요청에서 문의 주셨던 아이콘을 넣어놨어요. |
||
</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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
기존 Select 스토리북 경로 수정된 부분이에요.