mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:21:17 +08:00
37 lines
909 B
JavaScript
37 lines
909 B
JavaScript
import React from 'react';
|
|
import moment from 'moment';
|
|
import { storiesOf } from '@kadira/storybook';
|
|
import { action } from '@kadira/storybook-addon-actions';
|
|
import {
|
|
withKnobs,
|
|
number,
|
|
object,
|
|
boolean,
|
|
text,
|
|
select,
|
|
date
|
|
} from '../../src';
|
|
|
|
import Button from './Button';
|
|
|
|
const today = new Date();
|
|
|
|
storiesOf('Button', module)
|
|
.addDecorator(withKnobs)
|
|
.add('default view', () => (
|
|
<Button
|
|
onClick={ action('button clicked') }
|
|
disabled={ boolean('Disabled', false) }
|
|
color={ select('Height', { red: 'Red', blue: 'Blue', yellow: 'Yellow' }, 'red') }
|
|
width={ number('Width', 100) }
|
|
style={ object('Style', { backgroundColor: '#FFF' }) }
|
|
>
|
|
{ text('Label', 'Hello Man23') } World
|
|
<br/>
|
|
{ date('Date', today).toString() }
|
|
</Button>
|
|
))
|
|
.add('Story without any knobs', () => (
|
|
<Button>{text('Label', 'Hello')}</Button>
|
|
));
|