/* eslint-disable import/no-extraneous-dependencies */
import React from 'react';
import {
  Title,
  Description,
  Primary,
  PRIMARY_STORY,
  ArgsTable,
} from '@storybook/addon-docs/blocks';
import { FaTwitter } from '@react-icons/all-files/fa/FaTwitter';

import Author from '.';

export default {
  title: 'Theme/Atoms/Author Byline',
  component: Author,
  argTypes: {
    name: {
      name: 'name',
      type: { name: 'string', required: true },
      defaultValue: '',
      description: "The author's name.",
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: '' },
      },
    },
    icon: {
      name: 'icon',
      type: { name: 'element', required: false },
      defaultValue: 'null',
      description: "The author's social media icon.",
      table: {
        type: { summary: 'element | any' },
        defaultValue: { summary: 'null' },
      },
      control: {
        type: null,
      },
    },
    link: {
      name: 'link',
      type: { name: 'string', required: false },
      defaultValue: '',
      description: "The author's social media link.",
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: '' },
      },
    },
    authorProfile: {
      name: 'authorProfile',
      type: { name: 'string', required: false },
      defaultValue: '',
      description: "The author's profile link.",
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: '' },
      },
    },
    prefix: {
      name: 'prefix',
      type: { name: 'string', required: false },
      defaultValue: '',
      description: "The author's name prefix.",
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: '' },
      },
    },
    date: {
      name: 'date',
      type: { name: 'date', required: false },
      defaultValue: '',
      description: "The article's publish date.",
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: '' },
      },
    },
    dateFormat: {
      name: 'dateFormat',
      type: { name: 'string', required: false },
      defaultValue: 'DD.MM.YYYY',
      description: "The date's format.",
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: 'DD.MM.YYYY' },
      },
    },
    dateSeparator: {
      name: 'dateFormat',
      type: { name: 'string', required: false },
      defaultValue: '.',
      description: 'A character to separate day, month and year.',
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: '.' },
      },
    },
    showVerification: {
      name: 'showVerification',
      type: { name: 'boolean', required: false },
      defaultValue: '',
      description: 'Show verification badge for author',
      table: {
        type: { summary: 'boolean' },
        defaultValue: { summary: false },
      },
    },
  },
  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) => <Author {...args} />;

export const Default = Template.bind({});
Default.args = {
  name: 'Mohsen Barati',
  icon: <FaTwitter />,
  link: 'https://link.com',
  authorProfile: '/mohsenbarati',
  prefix: 'By:',
  date: '2020-04-24 15:37:42',
  dateFormat: 'DD.MM.YYYY',
  dateSeparator: '/',
};
