/* eslint-disable import/no-extraneous-dependencies */
import React from 'react';
import { storiesOf } from '@storybook/react';
import { text, select } from '@storybook/addon-knobs';
import { reduxForm } from 'redux-form';
import GenericFields from './GenericFields';

const field = [
  'string',
  'separator',
  'select',
  'schedule',
  'textarea',
  'multiarea',
  'multi',
  'bool',
  'date',
  'picture',
  'video',
  'wysiwyg',
  'multiwysiwyg',
];

storiesOf('admin/formHelpers/GenericFields', module)
  .addDecorator(
    (story): JSX => {
      const Wrapper = reduxForm({ form: 'test' })(() => story());
      return <Wrapper />;
    },
  )
  .add(
    'GenericFields component',
    (): JSX => (
      <GenericFields
        loadData={(): void => {}}
        loadOne={(): void => {}}
        push={(): void => {}}
        upload={(): void => {}}
        fields={{
          id: { type: select('type', field, 'string'), label: text('label', 'label') },
        }}
      />
    ),
  );
