import { Meta, StoryObj } from '@storybook/react-webpack5'; import { Sentiment, Size } from '../common'; import SentimentSurface from '../sentimentSurface'; import { withVariantConfig } from '../../.storybook/helpers'; import { allModes } from '../../.storybook/modes'; import StatusIcon, { StatusIconSentiment } from './StatusIcon'; export default { title: 'Other/StatusIcon/Tests', component: StatusIcon, tags: ['!autodocs', '!manifest'], } satisfies Meta; type Story = StoryObj; const sizes = [16, 24, 32, 40, 48, 56, 72] as const; const surfaceSentiments = ['success', 'warning', 'negative', 'neutral'] as const; // Cycle through different sentiments per size so each row shows varied icons const iconSentiments: StatusIconSentiment[] = [ Sentiment.POSITIVE, Sentiment.NEGATIVE, Sentiment.WARNING, Sentiment.NEUTRAL, Sentiment.PENDING, Sentiment.POSITIVE, Sentiment.NEGATIVE, ]; const rowStyle = { display: 'flex', alignItems: 'center', padding: '8px', gap: '8px', } as const; const labelStyle = { width: '120px', fontSize: '11px', fontWeight: 'bold', paddingLeft: '8px', flexShrink: 0, } as const; /** * All sentiments, emphasis levels, and sizes across all themes for visual regression testing. */ export const Variants: Story = { render: () => (
{surfaceSentiments.flatMap((sentiment) => [
{sentiment} (base)
{sizes.map((size, i) => ( ))}
,
{sentiment} (elevated)
{sizes.map((size, i) => ( ))}
, ])} {/* Row without a SentimentSurface wrapper — standalone fallback colours */}
none
{sizes.map((size, i) => ( ))}
), parameters: { padding: '16px', variants: ['default', 'dark', 'bright-green', 'forest-green'], }, }; export const RTL: Story = { render: Variants.render, ...withVariantConfig(['rtl']), }; /** * @deprecated Legacy `Size.SMALL | Size.MEDIUM | Size.LARGE` values still work but * consumers should migrate to numeric sizes. */ export const LegacySizes: Story = { render: () => { const legacySizes = [ { value: Size.SMALL, label: 'Size.SMALL' }, { value: Size.MEDIUM, label: 'Size.MEDIUM' }, { value: Size.LARGE, label: 'Size.LARGE' }, ] as const; return (
{legacySizes.map(({ value, label }) => (
{label}
))}
); }, };