DocSpace-client/web/ASC.Web.Components/example/stories/input/checkbox/checkbox.stories.js

36 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-06-25 15:49:12 +00:00
import React from 'react';
import { storiesOf } from '@storybook/react';
2019-06-26 13:25:35 +00:00
import { action } from '@storybook/addon-actions';
import { Value } from 'react-value';
2019-06-25 15:49:12 +00:00
import { withKnobs, boolean, text } from '@storybook/addon-knobs/react';
import withReadme from 'storybook-readme/with-readme';
import Readme from './README.md';
import { Checkbox } from 'asc-web-components';
import Section from '../../../.storybook/decorators/section';
storiesOf('Components|Input', module)
.addDecorator(withKnobs)
.addDecorator(withReadme(Readme))
.add('checkbox', () => (
<Section>
2019-06-26 13:25:35 +00:00
<Value
defaultValue={true}
render={(isChecked, onChange) => (
<Checkbox
id={text('id', 'id')}
name={text('name', 'name')}
value={text('value', 'value')}
label={text('label', 'label')}
isChecked={boolean('isChecked', isChecked)}
isIndeterminate={boolean('isIndeterminate', false)}
isDisabled={boolean('isDisabled', false)}
onChange={event => {
action('onChange')(event);
onChange(event.target.checked);
}}
/>
)}
2019-06-25 15:49:12 +00:00
/>
</Section>
));