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

import ScrollToTop from '.';

export default {
  title: 'Theme/Atoms/Scroll to Top',
  component: ScrollToTop,
  argTypes: {
    scrollTo: {
      name: 'scrollTo',
      type: { name: 'string', required: false },
      defaultValue: '0',
      description:
        'Specify where the page should scroll to, on click of the component. 0 is top of the page.',
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: '0' },
      },
    },
  },
  parameters: {
    docs: {
      description: {
        component:
          'A component, usually fixed to the bottom of the page, that scrolls to a specified place on the page on click. Usually used to scroll to the top of the page.',
      },
      page: () => (
        <>
          <Title />
          <Description />
          <Primary />
          <ArgsTable story={PRIMARY_STORY} />
        </>
      ),
    },
  },
};

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

export const Default = Template.bind({});
Default.args = {
  scrollTo: '0',
};
