import React from 'react';
import {
  Title,
  Description,
  Primary,
  PRIMARY_STORY,
  ArgsTable,
} from '@storybook/addon-docs/blocks';

import OpenGraph from '.';

export default {
  title: 'Theme/Atoms/Open Graph',
  component: OpenGraph,
  argTypes: {
    page: {
      name: 'page',
      type: { name: 'object', required: false },
      defaultValue: '',
      description: 'The current page object.',
      table: {
        type: { summary: 'object' },
        defaultValue: { summary: '' },
      },
    },
    text: {
      name: 'text',
      type: { name: 'string', required: false },
      defaultValue: 'Share: ',
      description: 'The share text content.',
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: 'Share: ' },
      },
    },
  },
  parameters: {
    docs: {
      description: {
        component: 'A component to share the page on Twitter & Facebook.',
      },
      page: () => (
        <>
          <Title />
          <Description />
          <Primary />
          <ArgsTable story={PRIMARY_STORY} />
        </>
      ),
    },
  },
};

const Template = (args) => <OpenGraph {...args} />;

export const Default = Template.bind({});
Default.args = {
  text: 'Share: ',
  page: {
    title: 'my sample title',
    path: '/my_sample_url',
  },
};
