2019-06-19 14:28:00 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { storiesOf } from '@storybook/react';
|
2019-06-26 15:17:52 +00:00
|
|
|
import { action } from '@storybook/addon-actions';
|
2019-06-19 14:28:00 +00:00
|
|
|
import { text, boolean, withKnobs, select } from '@storybook/addon-knobs/react';
|
2019-06-25 10:28:28 +00:00
|
|
|
import { MainButton, Button, Icons } from 'asc-web-components';
|
2019-06-20 14:25:45 +00:00
|
|
|
import Section from '../../../.storybook/decorators/section';
|
|
|
|
import withReadme from 'storybook-readme/with-readme';
|
|
|
|
import Readme from './README.md';
|
2019-06-19 14:28:00 +00:00
|
|
|
|
2019-06-25 10:28:28 +00:00
|
|
|
const iconNames = Object.keys(Icons);
|
2019-06-19 14:28:00 +00:00
|
|
|
|
2019-06-20 08:24:31 +00:00
|
|
|
function ClickMainButton(e, credentials) {
|
|
|
|
console.log("ClickMainButton", e, credentials);
|
|
|
|
}
|
|
|
|
|
|
|
|
function ClickSecondaryButton(e, credentials) {
|
|
|
|
console.log("ClickSecondaryButton", e, credentials);
|
|
|
|
}
|
|
|
|
|
2019-06-19 14:28:00 +00:00
|
|
|
storiesOf('Components|MainButton', module)
|
|
|
|
.addDecorator(withKnobs)
|
2019-06-20 14:25:45 +00:00
|
|
|
.addDecorator(withReadme(Readme))
|
2019-06-27 13:29:39 +00:00
|
|
|
.add('main button', () => {
|
2019-06-25 13:25:27 +00:00
|
|
|
|
|
|
|
let isDropdown=boolean('isDropdown', false);
|
|
|
|
|
|
|
|
let icon = !isDropdown ? {iconName: `${select('iconName', iconNames, 'PeopleIcon')}`} : {};
|
|
|
|
|
|
|
|
return (
|
2019-06-19 14:28:00 +00:00
|
|
|
<Section>
|
|
|
|
<MainButton
|
2019-06-20 14:25:45 +00:00
|
|
|
isDisabled={boolean('isDisabled', false)}
|
2019-06-25 13:25:27 +00:00
|
|
|
isDropdown={isDropdown}
|
2019-06-19 14:28:00 +00:00
|
|
|
text={text('text', 'Actions')}
|
2019-06-25 13:25:27 +00:00
|
|
|
|
2019-06-20 08:24:31 +00:00
|
|
|
clickAction={ClickMainButton}
|
|
|
|
clickActionSecondary={ClickSecondaryButton}
|
2019-06-25 13:25:27 +00:00
|
|
|
{...icon}
|
2019-06-19 14:28:00 +00:00
|
|
|
>
|
2019-06-25 10:28:28 +00:00
|
|
|
<Button
|
2019-06-26 15:17:52 +00:00
|
|
|
onClick={action('clicked')}
|
2019-06-25 10:28:28 +00:00
|
|
|
label='Base button'
|
|
|
|
size='base'
|
|
|
|
/>
|
|
|
|
<Button
|
2019-06-26 15:17:52 +00:00
|
|
|
onClick={action('clicked')}
|
2019-06-25 10:28:28 +00:00
|
|
|
label='Base button'
|
|
|
|
size='base'
|
2019-06-19 14:28:00 +00:00
|
|
|
/>
|
|
|
|
<Button
|
2019-06-26 15:17:52 +00:00
|
|
|
onClick={action('clicked')}
|
2019-06-19 14:28:00 +00:00
|
|
|
label='Base button'
|
|
|
|
size='base'
|
|
|
|
/>
|
|
|
|
</MainButton>
|
|
|
|
</Section>
|
2019-06-25 13:25:27 +00:00
|
|
|
)});
|