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

import Counter from '.';

export default {
  title: 'Theme/Molecules/Counter',
  component: Counter,
  argTypes: {
    module: {
      name: 'module',
      type: { name: 'object', required: false },
      defaultValue: '',
      description: 'The module data object',
      table: {
        type: { summary: 'object' },
        defaultValue: { summary: '' },
      },
    },
  },
  parameters: {
    docs: {
      description: {
        component:
          'Counter component displays one or more counters which loads and animates when section is visible in the browser viewport. Typically displays number of reviews and/or articles.',
      },
      page: () => (
        <>
          <Title />
          <Description />
          <Primary />
          <ArgsTable story={PRIMARY_STORY} />
        </>
      ),
    },
  },
};

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

export const Default = Template.bind({});
Default.args = {
  module: {
    items: [
      {
        link: '/articles',
        title: 'Articles',
        value: '76',
      },
      {
        link: '/reviews',
        title: 'Reviews',
        value: '115',
      },
    ],
    content:
      'The counter module content can describe what the module is counting. This module is counting the number of articles and reviews we have on the site.',
  },
};
