import React from 'react';
import { storiesOf } from '@storybook/react';
import { boolean, select, text } from '@storybook/addon-knobs';
import { asyncStates } from '../../../storybook/utils';
import { ErrorInline } from '../index';

const props = ({
  isInfoVariant = undefined,
  isInModal = undefined,
  isInForm = undefined,
  infoMessage = undefined,
  asyncStatus = undefined,
  asyncStatusList = undefined,
} = {}) => ({
  isInfoVariant: boolean('is info variant', isInfoVariant),
  isInModal: boolean('is in modal', isInModal),
  isInForm: boolean('is in form', isInForm),
  infoMessage: text('info message', infoMessage),
  asyncStatus: select('async status', asyncStates({ isList: false }), asyncStatus),
  asyncStatusList: select('async status list', asyncStates({ isList: true }), asyncStatusList),
});

storiesOf('Web|Error', module)
  .add('inline', () => (
    <ErrorInline {...props()} />
  ))
