/* eslint-disable import/no-extraneous-dependencies */
import React from 'react';
import {
  Title,
  Description,
  Primary,
  PRIMARY_STORY,
  ArgsTable,
} from '@storybook/addon-docs/blocks';
import getAuthorList from '../../../../../tests/factories/authors/author.factory';
import FactCheckIcon from '../../../../../storybook-images/icons/fact-check';

import Contributor from '.';

const authorData = getAuthorList({})[1];

export default {
  title: 'Theme/Layout/Author/Multiple Contributors/Single Contributor',
  component: Contributor,
  argTypes: {
    contributor: {
      name: 'contributor',
      type: { name: 'object', required: true },
      defaultValue: authorData,
      description: 'Contributor Data',
      table: {
        type: { summary: 'object' },
        defaultValue: { summary: null },
      },
    },
    authorImageWidth: {
      name: 'authorImageWidth',
      type: { name: 'number', required: false },
      defaultValue: 48,
      description: 'Author/Reviewer image width',
      table: {
        type: { summary: 'number' },
        defaultValue: { summary: 48 },
      },
    },
    authorImageHeight: {
      name: 'authorImageHeight',
      type: { name: 'number', required: false },
      defaultValue: 48,
      description: 'Author/Reviewer image height',
      table: {
        type: { summary: 'number' },
        defaultValue: { summary: 48 },
      },
    },
    isReviewer: {
      name: 'isReviewer',
      type: { name: 'boolean', required: false },
      defaultValue: false,
      description: 'Indicate if its a Reviewer',
      table: {
        type: { summary: 'boolean' },
        defaultValue: { summary: false },
      },
    },
    showTitle: {
      name: 'showTitle',
      type: { name: 'boolean', required: false },
      defaultValue: true,
      description: 'Show reviewer title',
      table: {
        type: { summary: 'boolean' },
        defaultValue: { summary: true },
      },
    },
    verifyIcon: {
      name: 'verifyIcon',
      type: { name: 'element', required: false },
      defaultValue: <FactCheckIcon width={15} height={15} />,
      description: 'Icon for verify badge',
      table: {
        type: { summary: 'element' },
        defaultValue: { summary: <FactCheckIcon width={15} height={15} /> },
      },
    },
  },
  parameters: {
    docs: {
      description: {
        component:
          'A component that accepts the author info and generates a his/her link name and social icons, used in news cards .',
      },
      page: () => (
        <>
          <Title />
          <Description />
          <Primary />
          <ArgsTable story={PRIMARY_STORY} />
        </>
      ),
    },
  },
};

const Template = (args) => (
  <div
    style={{
      maxWidth: '96rem',
      margin: '0 auto',
      padding: '0 4rem',
    }}
  >
    <Contributor {...args} />
  </div>
);

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