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

import InfoGrid from '.';
import getInfoGrids from '~tests/factories/modules/info-grid';

export default {
  title: 'Theme/Atoms/Info Grid',
  component: InfoGrid,
  argTypes: {
    data: {
      name: 'data',
      type: { name: 'array', required: true },
      defaultValue: null,
      description: 'Array of data objects.',
      table: {
        type: { summary: 'array' },
        defaultValue: { summary: null },
      },
    },
  },
  parameters: {
    docs: {
      description: {
        component:
          'A component that gets an array of data objects and generates divs including keys/values.',
      },
      page: () => (
        <>
          <Title />
          <Description />
          <Primary />
          <ArgsTable story={PRIMARY_STORY} />
        </>
      ),
    },
  },
};

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

export const Default = Template.bind({});
Default.args = {
  data: [
    { name: 'URL', value: 'https://microsoft.com' },
    { name: 'Owner', value: 'Bill Gates' },
    { name: 'Number of Products', value: '+100' },
  ],
};
