mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-24 03:01:01 +00:00
64d9792fe3
[web]: Handle exceeded editor limit in share modal GitOrigin-RevId: 23a15805ca98327ae4a7fc731bbca3982c90bad5
61 lines
1.3 KiB
TypeScript
61 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)}
|
|
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 const WithSelectedIcon = () => {
|
|
return (
|
|
<Select
|
|
items={items}
|
|
itemToString={x => String(x?.value)}
|
|
itemToKey={x => String(x.key)}
|
|
itemToSubtitle={x => x?.group ?? ''}
|
|
defaultText="Choose an item"
|
|
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 ?? ''}
|
|
defaultText="Choose an item"
|
|
/>
|
|
)
|
|
}
|
|
|
|
export default {
|
|
title: 'Shared / Components / Select',
|
|
component: Select,
|
|
}
|