Skip to content

Commit

Permalink
feat: refactor MultiSelect storyes
Browse files Browse the repository at this point in the history
  • Loading branch information
mimokmt committed Jan 31, 2024
1 parent 97e8f60 commit 821e9d8
Show file tree
Hide file tree
Showing 4 changed files with 668 additions and 461 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import { Meta, StoryObj } from '@storybook/react'
import styled from 'styled-components'
import MultiSelect, { MultiSelectGroup } from '..'

const StyledMultiSelectGroup = styled(MultiSelectGroup)`
display: grid;
grid-template-columns: 1fr;
gap: 8px;
`

export default {
title: 'MultiSelect/MultiSelectGroup',
component: MultiSelectGroup,
args: {
name: '',
label: '',
disabled: false,
readonly: false,
invalid: false,
variant: 'default',
},
argTypes: {
name: {
control: {
type: 'text',
},
},
label: {
control: {
type: 'text',
},
},
disabled: {
control: {
type: 'boolean',
},
},
readonly: {
control: {
type: 'boolean',
},
},
invalid: {
control: {
type: 'boolean',
},
},
},
render: function Render({
name,
label,
onChange,
disabled,
readonly,
invalid,
selected,
className,
}) {
return (
<StyledMultiSelectGroup
{...{
name,
label,
onChange,
disabled,
readonly,
invalid,
selected,
}}
>
{[1, 2, 3, 4].map((idx) => (
<MultiSelect
value={`選択肢${idx}`}
variant="default"
key={idx}
className={className}
>
選択肢{idx}
</MultiSelect>
))}
</StyledMultiSelectGroup>
)
},
} as Meta<typeof MultiSelectGroup>

export const Basic: StoryObj<typeof MultiSelectGroup> = {
args: {
selected: ['選択肢1', '選択肢3'],
},
}

export const Invalid: StoryObj<typeof MultiSelectGroup> = {
args: {
name: 'defaultName',
invalid: true,
},
}
Loading

0 comments on commit 821e9d8

Please sign in to comment.