/* eslint-disable import/no-extraneous-dependencies */
import React from 'react';
import {
  Title,
  Description,
  Primary,
  PRIMARY_STORY,
  ArgsTable,
} from '@storybook/addon-docs/blocks';
import getPageData from '../../../../tests/factories/pages/default.factory';
import InfoGrid from '.';

const pageData = getPageData();
const statsCounter = pageData?.sections?.header?.modules?.find(
  (modules) => modules?.name === 'statistics_counter'
);

export default {
  title: 'Theme/Modules/Template Blocks/Statistics Counter',
  component: InfoGrid,
  argTypes: {
    page: {
      name: 'page',
      type: { name: 'object', required: true },
      description: 'Page object',
      defaultValue: pageData,
    },
    module: {
      name: 'module',
      type: { name: 'object', required: true },
      description: 'module object',
      defaultValue: statsCounter,
    },
  },
  parameters: {
    docs: {
      description: {
        component:
          'A component that gets an object of data and generates divs including keys/values. This is the Default view',
      },
      page: () => (
        <>
          <Title />
          <Description />
          <Primary />
          <ArgsTable story={PRIMARY_STORY} />
        </>
      ),
    },
  },
};

const Template = (args) => (
  <div style={{ background: '#ffffff' }}>
    <InfoGrid {...args} />
  </div>
);

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