Storybook: Fix Input story (#91564)

fix type + prefix/suffix
This commit is contained in:
Ashley Harrison 2024-08-07 12:05:20 +02:00 committed by GitHub
parent 3ec2084c23
commit e8d5d5fbff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,12 +10,11 @@ import mdx from './Input.mdx';
import { parseAccessory } from './storyUtils'; import { parseAccessory } from './storyUtils';
const prefixSuffixOpts = { const prefixSuffixOpts = {
None: null, $: 'Text',
Text: '$',
...getAvailableIcons().reduce<KeyValue<string>>((prev, c) => { ...getAvailableIcons().reduce<KeyValue<string>>((prev, c) => {
return { return {
...prev, ...prev,
[`Icon: ${c}`]: `icon-${c}`, [`icon-${c}`]: `Icon: ${c}`,
}; };
}, {}), }, {}),
}; };
@ -43,20 +42,22 @@ const meta: Meta = {
prefixVisible: { prefixVisible: {
control: { control: {
type: 'select', type: 'select',
options: prefixSuffixOpts, labels: prefixSuffixOpts,
}, },
options: [null, ...Object.keys(prefixSuffixOpts)],
}, },
suffixVisible: { suffixVisible: {
control: { control: {
type: 'select', type: 'select',
options: prefixSuffixOpts, labels: prefixSuffixOpts,
}, },
options: [null, ...Object.keys(prefixSuffixOpts)],
}, },
type: { type: {
control: { control: {
type: 'select', type: 'select',
options: ['text', 'number', 'password'],
}, },
options: ['text', 'number', 'password'],
}, },
// validation: { name: 'Validation regex (will do a partial match if you do not anchor it)' }, // validation: { name: 'Validation regex (will do a partial match if you do not anchor it)' },
width: { control: { type: 'range', min: 10, max: 200, step: 10 } }, width: { control: { type: 'range', min: 10, max: 200, step: 10 } },