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

import CountDate from '.';

export default {
  title: 'Theme/Molecules/Counter/Count Date',
  component: CountDate,
  argTypes: {
    targetDate: {
      name: 'targetDate',
      type: { name: 'number', required: true },
      defaultValue: null,
      description: 'The target date that the component counts to.',
      table: {
        type: { summary: 'number' },
        defaultValue: { summary: null },
      },
    },
  },
  parameters: {
    docs: {
      description: {
        component: 'The count date component reduces by 1 second from now until the target date.',
      },
      page: () => (
        <>
          <Title />
          <Description />
          <Primary />
          <ArgsTable story={PRIMARY_STORY} />
        </>
      ),
    },
  },
};

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

export const Default = Template.bind({});
const twoDaysFuture = new Date().getTime() + 1000 * 3600 * 48;
Default.args = {
  targetDate: twoDaysFuture,
};
