DocSpace-buildtools/web/ASC.Web.Storybook/stories/buttons/base/base.button.stories.js

41 lines
1.4 KiB
JavaScript
Raw Normal View History

import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { withKnobs, boolean, text, select } from '@storybook/addon-knobs/react';
import withReadme from 'storybook-readme/with-readme';
import Readme from './README.md';
2019-07-02 08:04:54 +00:00
import { Button, Icons } from 'asc-web-components';
import Section from '../../../.storybook/decorators/section';
2019-07-02 08:04:54 +00:00
import { orderBy } from 'lodash';
storiesOf('Components|Buttons', module)
.addDecorator(withKnobs)
.addDecorator(withReadme(Readme))
2019-07-02 08:04:54 +00:00
.add('base', () => {
const sizeOptions = ['base', 'medium', 'big'];
2019-07-02 08:04:54 +00:00
const iconNames = orderBy(Object.keys(Icons), [name => name.toLowerCase()], ['asc']);
const iconName = select("icon", ['', ...iconNames], '');
const hintIcon = iconName ? React.createElement(Icons[iconName]) : undefined;
return (
<Section>
<Button
label={text('label', 'Base button')}
primary={boolean('primary', true)}
size={select('size', sizeOptions, 'big')}
scale={boolean('scale', false)}
2019-07-02 08:04:54 +00:00
isLoading={boolean('isLoading', false)}
isHovered={boolean('isHovered', false)}
isClicked={boolean('isClicked', false)}
isDisabled={boolean('isDisabled', false)}
2019-07-01 07:01:57 +00:00
2019-07-02 08:04:54 +00:00
onClick={action('clicked')}
2019-07-01 07:01:57 +00:00
2019-07-02 08:04:54 +00:00
icon={hintIcon}
/>
</Section>
)
});