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

import Collapse from '.';

export default {
  title: 'Theme/Atoms/Collapse',
  component: Collapse,
  argTypes: {
    buttonText: {
      name: 'buttonText',
      type: { name: 'string', required: false },
      defaultValue: '',
      description: 'Text of the open/close button.',
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: '' },
      },
    },
    contentText: {
      name: 'contentText',
      type: { name: 'string', required: false },
      defaultValue: '',
      description: 'Text Content.',
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: '' },
      },
    },
    onlyMobile: {
      name: 'onlyMobile',
      type: { name: 'boolean', required: false },
      defaultValue: '',
      description: 'Is True, shows only on mobile devices (not responsive web view port).',
      table: {
        type: { summary: 'boolean' },
        defaultValue: { summary: '' },
      },
    },
    onlyDesktop: {
      name: 'onlyDesktop',
      type: { name: 'boolean', required: false },
      defaultValue: '',
      description: 'Is True, shows only if it is not a mobile device.',
      table: {
        type: { summary: 'boolean' },
        defaultValue: { summary: '' },
      },
    },
    initOpen: {
      name: 'initOpen',
      type: { name: 'boolean', required: false },
      defaultValue: '',
      description: 'Is True, sets the box opened on first load.',
      table: {
        type: { summary: 'boolean' },
        defaultValue: { summary: '' },
      },
    },
  },
  parameters: {
    docs: {
      description: {
        component: 'Generates a collapsible box, with content & icon.',
      },
      page: () => (
        <>
          <Title />
          <Description />
          <Primary />
          <ArgsTable story={PRIMARY_STORY} />
        </>
      ),
    },
  },
};

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

export const Default = Template.bind({});
Default.args = {
  buttonText: 'show',
  contentText:
    "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy",
  onlyMobile: false,
  onlyDesktop: false,
  initOpen: false,
};
