-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
668 additions
and
461 deletions.
There are no files selected for viewing
97 changes: 97 additions & 0 deletions
97
packages/react/src/components/MultiSelect/MultiSelectGroup/MultiSelectGroup.story.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,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, | ||
}, | ||
} |
Oops, something went wrong.