mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-04 14:49:01 +02:00
452d854d5b
Unified access onboarding data collection pages GitOrigin-RevId: c56a3d52f749883eeb2302e22aaf6bdf1239160c
80 lines
1.6 KiB
TypeScript
80 lines
1.6 KiB
TypeScript
import { Select } from '@/shared/components/select'
|
|
import { Meta } from '@storybook/react'
|
|
|
|
type Args = Pick<
|
|
React.ComponentProps<typeof Select>,
|
|
'disabled' | 'defaultText' | 'isCiam'
|
|
>
|
|
|
|
const items = [1, 2, 3, 4].map(index => ({
|
|
key: index,
|
|
value: `Demo item ${index}`,
|
|
group: index >= 3 ? 'Large numbers' : undefined,
|
|
}))
|
|
|
|
export const Base = (args: Args) => {
|
|
return (
|
|
<Select
|
|
{...args}
|
|
items={items}
|
|
itemToString={x => String(x?.value)}
|
|
itemToKey={x => String(x.key)}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export const WithSubtitles = (args: Args) => {
|
|
return (
|
|
<Select
|
|
{...args}
|
|
items={items}
|
|
itemToString={x => String(x?.value)}
|
|
itemToKey={x => String(x.key)}
|
|
itemToSubtitle={x => x?.group ?? ''}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export const WithSelectedIcon = (args: Args) => {
|
|
return (
|
|
<Select
|
|
{...args}
|
|
items={items}
|
|
itemToString={x => String(x?.value)}
|
|
itemToKey={x => String(x.key)}
|
|
itemToSubtitle={x => x?.group ?? ''}
|
|
selectedIcon
|
|
/>
|
|
)
|
|
}
|
|
|
|
export const WithDisabledItem = (args: Args) => {
|
|
return (
|
|
<Select
|
|
{...args}
|
|
items={items}
|
|
itemToString={x => String(x?.value)}
|
|
itemToKey={x => String(x.key)}
|
|
itemToDisabled={x => x?.key === 1}
|
|
itemToSubtitle={x => x?.group ?? ''}
|
|
/>
|
|
)
|
|
}
|
|
|
|
const meta: Meta<typeof Select> = {
|
|
title: 'Shared / Components / Select',
|
|
component: Select,
|
|
parameters: {
|
|
controls: {
|
|
include: ['disabled', 'defaultText', 'isCiam'],
|
|
},
|
|
},
|
|
args: {
|
|
disabled: false,
|
|
isCiam: false,
|
|
defaultText: 'Choose an item',
|
|
},
|
|
}
|
|
|
|
export default meta
|