/* eslint-disable import/no-extraneous-dependencies */
import React from 'react';
import {
  Title,
  Description,
  Primary,
  PRIMARY_STORY,
  ArgsTable,
} from '@storybook/addon-docs/blocks';
import { MdInfo } from '@react-icons/all-files/md/MdInfo';
import { MdPortrait } from '@react-icons/all-files/md/MdPortrait';
import getOperatorData from '../../../../../tests/factories/pages/operator.factory';
import getAuthorList from '../../../../../tests/factories/authors/author.factory';
import InfoGrid from '.';

const pageData = getOperatorData();
const authorPageData = {
  ...pageData,
  relation: getAuthorList({})[1],
  template: 'authors',
  type: 'authors',
  pageTemplate: 'authors',
};

export default {
  title: 'Theme/Modules/Template Blocks/Info Grid/Template Three',
  component: InfoGrid,
  argTypes: {
    page: {
      name: 'page',
      type: { name: 'object', required: true },
      description: 'Page object',
      defaultValue: authorPageData,
    },
    onlyMobile: {
      name: 'onlyMobile',
      type: { name: 'boolean', required: false },
      defaultValue: true,
      description:
        'Show/hide collapse button on mobile using collapse component. Only for grid view. Not available for two column view',
    },
    showTwoColumns: {
      name: 'showTwoColumns',
      type: { name: 'boolean', required: false },
      defaultValue: false,
      description: 'Show as two columns. Default is to show as grid.',
    },
    showHyphen: {
      name: 'showHyphen',
      type: { name: 'boolean', required: false },
      defaultValue: false,
      description: 'Show ":" after labels.',
    },
    infoIcon: {
      name: 'infoIcon',
      type: { name: 'element', required: false },
      defaultValue: <MdInfo />,
      description:
        'Show icon for column heading. Only available for two column view. Set "showTwoColumns" to true to test this',
    },
    detailsIcon: {
      name: 'detailsIcon',
      type: { name: 'element', required: false },
      defaultValue: <MdPortrait />,
      description:
        'Show icon for column heading. Only available for two column view. Set "showTwoColumns" to true to test this',
    },
    showEmojis: {
      name: 'showEmojis',
      type: { name: 'boolean', required: false },
      defaultValue: false,
      description: 'Show/hide emojis on labels.',
    },
    showSeeMoreButton: {
      name: 'showSeeMoreButton',
      type: { name: 'boolean', required: false },
      defaultValue: false,
      description: 'Switch to template two',
    },
    showInitial: {
      name: 'showInitial',
      type: { name: 'number', required: false },
      defaultValue: 6,
      description: 'Initial number of items to show. Only on template two',
    },
    templateThree: {
      name: 'templateThree',
      type: { name: 'boolean', required: false },
      defaultValue: true,
      description: 'Show as Template three for author review pages',
    },
  },
  parameters: {
    docs: {
      description: {
        component:
          'A component that gets an object of data and generates divs including keys/values. This is the Default view',
      },
      page: () => (
        <>
          <Title />
          <Description />
          <Primary />
          <ArgsTable story={PRIMARY_STORY} />
        </>
      ),
    },
  },
};

const Template = (args) => (
  <div style={{ background: '#ffffff' }}>
    <InfoGrid {...args} />
  </div>
);

export const Default = Template.bind({});
Default.args = {};
