mirror of
https://github.com/maputnik/editor.git
synced 2025-12-28 17:10:01 +00:00
Added 'a11y' and 'source' addons to storybook as well as more stories
This commit is contained in:
55
stories/FieldDynamicArray.stories.js
Normal file
55
stories/FieldDynamicArray.stories.js
Normal file
@@ -0,0 +1,55 @@
|
||||
import React from 'react';
|
||||
import {useActionState} from './helper';
|
||||
import FieldDynamicArray from '../src/components/FieldDynamicArray';
|
||||
import {Wrapper} from './ui';
|
||||
import {withA11y} from '@storybook/addon-a11y';
|
||||
|
||||
export default {
|
||||
title: 'FieldDynamicArray',
|
||||
component: FieldDynamicArray,
|
||||
decorators: [withA11y],
|
||||
};
|
||||
|
||||
|
||||
export const NumberType = () => {
|
||||
const [value, setValue] = useActionState("onChange", [1,2,3]);
|
||||
|
||||
return (
|
||||
<Wrapper>
|
||||
<FieldDynamicArray
|
||||
type="number"
|
||||
value={value}
|
||||
onChange={setValue}
|
||||
/>
|
||||
</Wrapper>
|
||||
);
|
||||
};
|
||||
|
||||
export const UrlType = () => {
|
||||
const [value, setValue] = useActionState("onChange", ["http://example.com"]);
|
||||
|
||||
return (
|
||||
<Wrapper>
|
||||
<FieldDynamicArray
|
||||
type="url"
|
||||
value={value}
|
||||
onChange={setValue}
|
||||
/>
|
||||
</Wrapper>
|
||||
);
|
||||
};
|
||||
|
||||
export const EnumType = () => {
|
||||
const [value, setValue] = useActionState("onChange", ["foo"]);
|
||||
|
||||
return (
|
||||
<Wrapper>
|
||||
<FieldDynamicArray
|
||||
fieldSpec={{values: {"foo": null, "bar": null, "baz": null}}}
|
||||
type="enum"
|
||||
value={value}
|
||||
onChange={setValue}
|
||||
/>
|
||||
</Wrapper>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user