import {ArgsTable, Meta, Story, Canvas} from '@storybook/addon-docs';
import SubjectIconBox, {TYPE, SIZE} from './SubjectIconBox';
import {StoryVariant} from '../../docs/utils';
import PageHeader from 'blocks/PageHeader';
import Flex from '../flex/Flex';
import {formatTags} from '../../docs/utils';

<Meta
  title="Components/SubjectIconBox"
  component={SubjectIconBox}
  argTypes={{
    type: {
      control: {type: 'select', options: TYPE},
      table: {
        type: {
          summary: formatTags(Object.values(TYPE)),
        },
      },
    },
    size: {
      control: {
        type: 'select',
        options: Object.values(SIZE),
      },
      table: {
        type: {
          summary: formatTags(Object.values(SIZE)),
        },
        defaultValue: {
          summary: SIZE.NORMAL,
        },
      },
    },
  }}
  args={{
    type: TYPE.ACCOUNTANCY,
  }}
/>

<PageHeader>SubjectIconBox</PageHeader>

- [Stories](#stories)

## Overview

<Canvas>
  <Story name="Default">{args => <SubjectIconBox {...args} />}</Story>
</Canvas>

<ArgsTable story="Default" />

## Stories

### Types

<Canvas>
  <Story name="Types">
    {args => (
      <Flex wrap>
        {Object.values(TYPE).map(type => (
          <StoryVariant label={`type - ${type}`} width={200} key={type}>
            <SubjectIconBox {...args} type={type} />
          </StoryVariant>
        ))}
      </Flex>
    )}
  </Story>
</Canvas>

### Sizes

<Canvas>
  <Story name="Sizes">
    {args => (
      <div>
        {Object.values(SIZE).map(size => (
          <StoryVariant label={`size - ${size}`} key={size}>
            <SubjectIconBox {...args} size={size} />
          </StoryVariant>
        ))}
      </div>
    )}
  </Story>
</Canvas>

### Darker

<Canvas>
  <Story name="Darker">
    {args => (
      <Flex wrap>
        {Object.values(TYPE).map(type => (
          <StoryVariant label={`type - ${type}`} width={200} key={type}>
            <SubjectIconBox {...args} type={type} darker />
          </StoryVariant>
        ))}
      </Flex>
    )}
  </Story>
</Canvas>
