import React from 'react';
// eslint-disable-next-line import/no-extraneous-dependencies
import {
  Title,
  Description,
  Primary,
  PRIMARY_STORY,
  ArgsTable,
} from '@storybook/addon-docs/blocks';
import { siteSchema } from 'gatsby-core-theme/tests/factories/modules/site-schema.factory';
import SocialIcons from '.';

const socialIcons =
  siteSchema &&
  (({ instagram, facebook, twitter, linkedin, youtube }) => ({
    instagram,
    facebook,
    twitter,
    linkedin,
    youtube,
  }))(siteSchema);

export default {
  title: 'Theme/Atoms/Social Icons',
  component: SocialIcons,
  argTypes: {
    socialIcons: {
      name: 'social icons',
      type: { name: 'object', required: true },
      defaultValue: '',
      description: 'social icons object data',
    },
  },
  parameters: {
    docs: {
      description: {
        component: 'A component that displays social icons',
      },
      page: () => (
        <>
          <Title />
          <Description />
          <Primary />
          <ArgsTable story={PRIMARY_STORY} />
        </>
      ),
    },
  },
};

const Template = (args) => <SocialIcons {...args} />;
export const Default = Template.bind({});
Default.args = {
  socialIcons,
};
