2019-06-27 12:47:32 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { storiesOf } from '@storybook/react';
|
|
|
|
import { action } from '@storybook/addon-actions';
|
2019-06-28 08:14:58 +00:00
|
|
|
import { BooleanValue } from 'react-values'
|
2019-06-27 12:47:32 +00:00
|
|
|
import withReadme from 'storybook-readme/with-readme';
|
|
|
|
import Readme from './README.md';
|
|
|
|
import Section from '../../.storybook/decorators/section';
|
|
|
|
import { ModalDialog, Button } from 'asc-web-components';
|
|
|
|
|
|
|
|
|
|
|
|
storiesOf('Components|ModalDialog', module)
|
|
|
|
.addDecorator(withReadme(Readme))
|
|
|
|
.add('Modal dialog', () => (
|
|
|
|
<Section>
|
2019-06-28 08:24:06 +00:00
|
|
|
<BooleanValue>
|
2019-06-28 08:14:58 +00:00
|
|
|
{({ value, toggle }) => (
|
|
|
|
<div>
|
2019-06-28 08:24:06 +00:00
|
|
|
<Button
|
|
|
|
label="Show"
|
|
|
|
primary={true}
|
|
|
|
onClick={(e) => {
|
|
|
|
action('onShow')(e);
|
|
|
|
toggle(true);
|
|
|
|
}}
|
|
|
|
/>
|
2019-06-28 08:14:58 +00:00
|
|
|
<ModalDialog
|
2019-07-11 15:02:48 +00:00
|
|
|
visible={value}
|
2019-06-28 08:14:58 +00:00
|
|
|
headerContent={"Header text"}
|
2019-06-28 08:24:06 +00:00
|
|
|
bodyContent={
|
|
|
|
<p>{"Body text"}</p>
|
|
|
|
}
|
2019-06-28 08:14:58 +00:00
|
|
|
footerContent={[
|
2019-06-28 08:24:06 +00:00
|
|
|
<Button
|
|
|
|
key="OkBtn"
|
|
|
|
label="Ok"
|
|
|
|
primary={true}
|
|
|
|
onClick={(e) => {
|
|
|
|
action('onOk')(e);
|
|
|
|
toggle(false);
|
|
|
|
}}
|
|
|
|
/>,
|
|
|
|
<Button
|
|
|
|
key="CancelBtn"
|
|
|
|
label="Cancel"
|
|
|
|
onClick={(e) => {
|
|
|
|
action('onCancel')(e);
|
|
|
|
toggle(false);
|
|
|
|
}}
|
|
|
|
style={{marginLeft:"8px"}}
|
|
|
|
/>
|
2019-06-28 08:14:58 +00:00
|
|
|
]}
|
2019-06-28 08:24:06 +00:00
|
|
|
onClose={e => {
|
|
|
|
action('onClose')(e);
|
|
|
|
toggle(false);
|
|
|
|
}}
|
2019-06-28 08:14:58 +00:00
|
|
|
/>
|
|
|
|
</div>
|
2019-06-27 12:47:32 +00:00
|
|
|
)}
|
2019-06-28 08:14:58 +00:00
|
|
|
</BooleanValue>
|
2019-06-27 12:47:32 +00:00
|
|
|
</Section>
|
|
|
|
));
|