1 | import React, {Fragment} from 'react';
|
2 | import {storiesOf} from '@storybook/html';
|
3 | import {withState} from 'recompose';
|
4 |
|
5 | import reactDecorator from '../../.storybook/react-decorator';
|
6 | import Radio from '../radio/radio';
|
7 |
|
8 | storiesOf('Components|Radio', module).
|
9 | addParameters({
|
10 | notes: 'Displays a radio button. Adopted from [react-radio-group](https://github.com/chenglou/react-radio-group).'
|
11 | }).
|
12 | addDecorator(reactDecorator()).
|
13 | add('basic', () => {
|
14 | const RadioExample = withState('value', 'onChange', 'one')(props => (
|
15 | <Fragment>
|
16 | Selected: {props.value}
|
17 | <Radio {...props}>
|
18 | <Radio.Item value="one">One</Radio.Item>
|
19 | <Radio.Item value="two">Two</Radio.Item>
|
20 | <Radio.Item value="three">Three</Radio.Item>
|
21 | </Radio>
|
22 | </Fragment>
|
23 | ));
|
24 |
|
25 | return <RadioExample/>;
|
26 | }).
|
27 | add('uncontrolled', () => (
|
28 | <Radio>
|
29 | <Radio.Item value="one" defaultChecked>One</Radio.Item>
|
30 | <Radio.Item value="two">Two</Radio.Item>
|
31 | <Radio.Item value="three">Three</Radio.Item>
|
32 | </Radio>
|
33 | ), {hermione: {skip: true}}).
|
34 | add('disabled', () => (
|
35 | <Radio disabled>
|
36 | <Radio.Item value="one" defaultChecked>One</Radio.Item>
|
37 | <Radio.Item value="two">Two</Radio.Item>
|
38 | <Radio.Item value="three">Three</Radio.Item>
|
39 | </Radio>
|
40 | ));
|