import React from 'react';
import { storiesOf } from '@storybook/react';
import { text, select, boolean } from '@storybook/addon-knobs';
import { action } from '@storybook/addon-actions';
import OptionsHelper from '../../utils/helpers/options-helper/options-helper';
import notes from './notes.md';
import { State, Store } from '@sambego/storybook-state';
import Dialog from './dialog-full-screen';
import Button from '../button';

const store = new Store({
  open: false
});

const handleCancel = () => {
  store.set({ open: false });
  action('cancel')();
};
const handleOpen = () => {
  store.set({ open: true });
  action('open')();
};

storiesOf('Dialog Full Screen', module)
  .add('default', () => {
    const open = boolean('open', false);
    const title = text('title', 'Example Dialog');
    const subtitle = text('subtitle', 'Example Subtitle');
    const children = text('children', 'Text Content');
    const enableBackgroundUI = boolean('enableBackgroundUI', false);
    const disableEscKey = boolean('disableEscKey', false);
    const ariaRole = text('ariaRole', 'dialog');

    return (
      <Dialog 
        open={open}
        onCancel={ handleCancel }
        title={title}
        subtitle={subtitle}
        children={children}
        enableBackgroundUI={enableBackgroundUI}
        disableEscKey={disableEscKey}
        ariaRole={ariaRole}
        onClick={ action('click') }
      />
    );
  }, {
    notes: { markdown: notes }
  })
  .add('withButton', () => {
    const title = text('title', 'Example Dialog');
    const subtitle = text('subtitle', 'Example Subtitle');
    const children = text('children', 'Text Content');
    const enableBackgroundUI = boolean('enableBackgroundUI', false);
    const disableEscKey = boolean('disableEscKey', false);
    const ariaRole = text('ariaRole', 'dialog');

    return (
      <State store={ store }>
        <Button onClick={ handleOpen }>Open Preview</Button>
        <Dialog 
          open={ store.get('open') }
          onCancel={ handleCancel }
          title={title}
          subtitle={subtitle}
          children={children}
          enableBackgroundUI={enableBackgroundUI}
          disableEscKey={disableEscKey}
          ariaRole={ariaRole}
          onClick={ action('click') }
        />
      </State>
    );
  }, {
    notes: { markdown: notes }
  });

@@ -84,16 +84,8 @@
 ext,
- select,
  boo
@@ -177,87 +177,8 @@
 s';%0A
-import OptionsHelper from '../../utils/helpers/options-helper/options-helper';%0A
 impo
@@ -646,21 +646,26 @@
 'open', 
-false
+store.open
 );%0A    c

Remove Dependancies from Storybook Dialog Full Screen