mirror of
https://github.com/maputnik/editor.git
synced 2026-08-27 23:47:27 +00:00
Fixed more input accessibility issues, also
- Added searchParams based router for easier testing - Added more stories to the storybook
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
import React from 'react';
|
||||
import {useActionState} from './helper';
|
||||
import InputEnum from '../src/components/InputEnum';
|
||||
import {InputContainer} from './ui';
|
||||
import {withA11y} from '@storybook/addon-a11y';
|
||||
|
||||
export default {
|
||||
title: 'InputEnum',
|
||||
component: InputEnum,
|
||||
decorators: [withA11y],
|
||||
};
|
||||
|
||||
|
||||
export const BasicFew = () => {
|
||||
const options = ["Foo", "Bar", "Baz"];
|
||||
const [value, setValue] = useActionState("onChange", "Foo");
|
||||
|
||||
return (
|
||||
<InputContainer>
|
||||
<InputEnum
|
||||
options={options}
|
||||
value={value}
|
||||
onChange={setValue}
|
||||
/>
|
||||
</InputContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export const BasicFewWithDefault = () => {
|
||||
const options = ["Foo", "Bar", "Baz"];
|
||||
const [value, setValue] = useActionState("onChange", null);
|
||||
|
||||
return (
|
||||
<InputContainer>
|
||||
<InputEnum
|
||||
options={options}
|
||||
default={"Baz"}
|
||||
value={value}
|
||||
onChange={setValue}
|
||||
/>
|
||||
</InputContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export const BasicMany = () => {
|
||||
const options = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"];
|
||||
const [value, setValue] = useActionState("onChange", "a");
|
||||
|
||||
return (
|
||||
<InputContainer>
|
||||
<InputEnum
|
||||
options={options}
|
||||
value={value}
|
||||
onChange={setValue}
|
||||
/>
|
||||
</InputContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export const BasicManyWithDefault = () => {
|
||||
const options = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"];
|
||||
const [value, setValue] = useActionState("onChange", "a");
|
||||
|
||||
return (
|
||||
<InputContainer>
|
||||
<InputEnum
|
||||
options={options}A
|
||||
default={"h"}
|
||||
value={value}
|
||||
onChange={setValue}
|
||||
/>
|
||||
</InputContainer>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user