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

const props = ({
  isApp = undefined,
  isInfoVariant = undefined,
  isDetermineInfoVariant = undefined,
  hasAsyncStatus = undefined,
  infoMessage = undefined,
  asyncStatus = undefined,
  asyncStatusList = undefined,
} = {}) => ({
  isApp: boolean('is app variant', isApp),
  isInfoVariant: boolean('is info variant', isInfoVariant),
  isDetermineInfoVariant: boolean('is determine info variant', isDetermineInfoVariant),
  hasAsyncStatus: boolean('has async status', hasAsyncStatus),
  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('page', () => (
    <ErrorPage {...props()} />
  ))
