import { Meta, StoryObj } from '@storybook/react';

import { Size, Sentiment } from '../common';

import StatusIcon from './StatusIcon';

export default {
  component: StatusIcon,
  title: 'Other/StatusIcon',
} satisfies Meta<typeof StatusIcon>;

type Story = StoryObj<typeof StatusIcon>;

export const Basic: Story = {
  render: (args) => (
    <span style={{ display: 'flex' }}>
      <StatusIcon {...args} />
    </span>
  ),
};

export const Variants: Story = {
  render: () => (
    <span style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '400px' }}>
      {[
        Sentiment.POSITIVE,
        Sentiment.NEGATIVE,
        Sentiment.NEUTRAL,
        Sentiment.WARNING,
        Sentiment.PENDING,
      ].map((sentiment) => {
        return (
          <span
            key={sentiment}
            style={{
              display: 'flex',
              justifyContent: 'space-between',
              flexDirection: 'column',
              minHeight: '150px',
              alignItems: 'center',
            }}
          >
            {([Size.SMALL, Size.MEDIUM, Size.LARGE] as const).map((size) => {
              return <StatusIcon key={size} size={size} sentiment={sentiment} />;
            })}
          </span>
        );
      })}
    </span>
  ),
};
