import { Meta, Story, ArgsTable, Canvas } from '@storybook/blocks';
import { createNamespace } from '../../../tools/namingTools';
import Icon from '../Icon';
import types from '../types';
import '../styles/Icon.story.scss';
import * as IconStories from './Icon.stories';

export const storyRowStyle = {
    display: 'flex',
    alignItems: 'center',
    padding: '4px 12px',
    marginBottom: '6px'
};
export const iconWrapperStyle = {
    display: 'flex'
};

export const renderIcons = ns => Object.keys(types).map(type => (
    <div
        style={storyRowStyle}
        key={`icon-${type}`}
    >
        <span style={{ marginRight: '20px' }}>
            {`type ${type}`}
        </span>
        <div style={iconWrapperStyle}>
            <Icon
                type={type}
                {...ns('story', type).props}
            />
        </div>
    </div>
));

<Meta of={IconStories} />

# Icon

<br />

## `Icons` are used to insert symbols representing a particular thing or action.

<br />

### All types at matching sizes

<Canvas>
  <Story of={IconStories.AllTypesAtMatchingSizes} />
</Canvas>

### With other colors and sizes

<Canvas>
  <Story of={IconStories.WithOtherColorsAndSizes} />
</Canvas>

### Ratings

<Canvas>
  <Story of={IconStories.Ratings} />
</Canvas>

## Usage Example

```jsx
import Icon from '@appdirect/sfb-theme-components/src/atoms/icon/Icon';

<Icon type="star" className="iconRatings_positiveStar" />
```

## Props

<ArgsTable of={Icon} />
