/* eslint-disable import/no-extraneous-dependencies */
import React from 'react';
import {
  Title,
  Description,
  Primary,
  PRIMARY_STORY,
  ArgsTable,
} from '@storybook/addon-docs/blocks';

import Cards from '.';
import { getListCardItem } from '~tests/factories/modules/card.factory';

export default {
  title: 'Theme/Organisms/Cards',
  component: Cards,
  argTypes: {
    module: {
      name: 'module',
      type: { name: 'object', required: false },
      defaultValue: '',
      description: 'The module data object',
      table: {
        type: { summary: 'object' },
        defaultValue: { summary: null },
      },
    },
    page: {
      name: 'page',
      type: { name: 'object', required: false },
      defaultValue: null,
      description: 'The page data object',
      table: {
        type: { summary: 'object' },
        defaultValue: { summary: null },
      },
    },
    CustomCardComponent: {
      name: 'CustomCardComponent',
      type: { name: 'element', required: false },
      defaultValue: null,
      description: 'Cards data, for example a custom `<ArticleCard />` component.',
      table: {
        type: { summary: 'element' },
        defaultValue: { summary: null },
      },
      control: null,
    },
  },
  parameters: {
    docs: {
      description: {
        component:
          'Cards component accepts a `<CustomCardComponent />` which is the inner card, typically showing article, casino, slot or author information. The custom cards are usually unique to a specific theme, see Matrix-Theme Cards story for example. Below is the default card, not used in sites but set up so that it can be easily overidden per theme.',
      },
      page: () => (
        <>
          <Title />
          <Description />
          <Primary />
          <ArgsTable story={PRIMARY_STORY} />
        </>
      ),
    },
  },
};

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

export const Default = Template.bind({});
Default.args = {
  module: getListCardItem(4),
  page: {
    path: '/sample',
  },
};
