Added 'a11y' and 'source' addons to storybook as well as more stories

This commit is contained in:
orangemug
2020-06-03 09:52:54 +01:00
parent 624ccb5b00
commit 90dfbf37e0
17 changed files with 594 additions and 6 deletions

View File

@@ -0,0 +1,44 @@
import React from 'react';
import {useActionState} from './helper';
import FieldArray from '../src/components/FieldArray';
import {Wrapper} from './ui';
import {withA11y} from '@storybook/addon-a11y';
export default {
title: 'FieldArray',
component: FieldArray,
decorators: [withA11y],
};
export const NumberType = () => {
const [value, setValue] = useActionState("onChange", [1,2,3]);
return (
<Wrapper>
<FieldArray
type="number"
value={value}
length={3}
onChange={setValue}
/>
</Wrapper>
);
};
export const StringType = () => {
const [value, setValue] = useActionState("onChange", ["a", "b", "c"]);
return (
<Wrapper>
<FieldArray
type="string"
value={value}
length={3}
onChange={setValue}
/>
</Wrapper>
);
};