Files
Verso/services/web/frontend/stories/shared/select.stories.tsx
T
Rebeka DekanyandCopybot cc49eeacbd Update Storybook controls for shared component stories and add Figma links for preview (#28634)
* Rename ui to shared

* Delete unused Switch component

* Update stories with Figma links

* Update Tag story naming for clarity

* Update Toggle button story naming for clarity

* Move shared components to the shared folder

* Remove file as part of TS migration

* Migrate jsx to tsx

* Remove file as part of TS migration

* Migrate jsx to tsx

* Include necessary controls only

* Auto SF

GitOrigin-RevId: d2458eeffa7a6b67ce522c3ccb6b4f71e5e76d62
2025-09-25 08:05:53 +00:00

67 lines
1.3 KiB
TypeScript

import { Select } from '../../js/shared/components/select'
const items = [1, 2, 3, 4].map(index => ({
key: index,
value: `Demo item ${index}`,
group: index >= 3 ? 'Large numbers' : undefined,
}))
export const Base = () => {
return (
<Select
items={items}
itemToString={x => String(x?.value)}
itemToKey={x => String(x.key)}
/>
)
}
export const WithSubtitles = () => {
return (
<Select
items={items}
itemToString={x => String(x?.value)}
itemToKey={x => String(x.key)}
itemToSubtitle={x => x?.group ?? ''}
/>
)
}
export const WithSelectedIcon = () => {
return (
<Select
items={items}
itemToString={x => String(x?.value)}
itemToKey={x => String(x.key)}
itemToSubtitle={x => x?.group ?? ''}
selectedIcon
/>
)
}
export const WithDisabledItem = () => {
return (
<Select
items={items}
itemToString={x => String(x?.value)}
itemToKey={x => String(x.key)}
itemToDisabled={x => x?.key === 1}
itemToSubtitle={x => x?.group ?? ''}
/>
)
}
export default {
title: 'Shared / Components / Select',
component: Select,
parameters: {
controls: {
include: ['disabled', 'defaultText'],
},
},
args: {
disabled: false,
defaultText: 'Choose an item',
},
}