mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 06:55:22 -05:00
f4408c3fa6
[web] Add figure modal components to storybook GitOrigin-RevId: 9916de620785e3a7dd982f6494f7b471f69c58f7
35 lines
734 B
TypeScript
35 lines
734 B
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)}
|
|
defaultText="Choose an item"
|
|
/>
|
|
)
|
|
}
|
|
|
|
export const WithSubtitles = () => {
|
|
return (
|
|
<Select
|
|
items={items}
|
|
itemToString={x => String(x?.value)}
|
|
itemToKey={x => String(x.key)}
|
|
itemToSubtitle={x => x?.group ?? ''}
|
|
defaultText="Choose an item"
|
|
/>
|
|
)
|
|
}
|
|
|
|
export default {
|
|
title: 'Shared / Components / Select',
|
|
component: Select,
|
|
}
|