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

import Breadcrumbs from '.';
import getPageData from '~tests/factories/pages/default.factory';

export default {
  title: 'Theme/Atoms/Breadcrumbs',
  component: Breadcrumbs,
  argTypes: {
    page: {
      name: 'page',
      type: { name: 'object', required: true },
      defaultValue: null,
      description: 'The current page object.',
      table: {
        type: { summary: 'object' },
        defaultValue: { summary: null },
      },
    },
    separator: {
      name: 'separator',
      type: { name: 'string', required: false },
      defaultValue: '<span> / </span>',
      description: 'A component to show between links.',
      table: {
        type: { summary: 'any | element' },
        defaultValue: { summary: '<span> / </span>' },
      },
    },
  },
  parameters: {
    docs: {
      description: {
        component:
          'A component that accepts the page object and options and generates a graphical step by step navigation links  from the home page to the current page.',
      },
      page: () => (
        <>
          <Title />
          <Description />
          <Primary />
          <ArgsTable story={PRIMARY_STORY} />
        </>
      ),
    },
  },
};

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

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

Default.args = {
  page: getPageData(),
  separator: ' / ',
};
