import { Meta, StoryObj } from '@storybook/react-webpack5'; import { Camera, Convert, FastFlag, Freeze, Graph, Leaf, Money, PlusCircle, Rewards, } from '@transferwise/icons'; import AvatarView from '..'; import { getBrandColorFromSeed, getInitials, ProfileType } from '../../common'; import Display from '../../Display'; import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator'; import { withVariantConfig } from '../../../.storybook/helpers'; const meta: Meta = { component: AvatarView, tags: ['!autodocs', '!manifest'], title: 'Content/AvatarView/Tests', }; export default meta; type Story = StoryObj; const profileName1 = 'Wolter White'; const profileName2 = 'Tyler Durden'; export const EdgeInstances: Story = { render: () => { const css = `.custom-variant { border: 1px dashed var(--color-border-neutral); }`; return (
{null} {getInitials(profileName1)} {getInitials(profileName1)} {getInitials(profileName1)} {getInitials(profileName1)} 9+ 5+
); }, }; export const ProfileBrokenImageFallback: Story = { parameters: { chromatic: { delay: 5000, }, }, render: () => { const assetUrl = 'https://test.com/img-wrong-url.test'; return ( <> ); }, }; /** Badge types across default and dark themes to verify icon color visibility. */ export const BadgeVariants: Story = { render: function Render() { return (
}}> }} />
}}> }} />
}}> }}>
), }} />
), }} /> ); }, ...withVariantConfig(['default', 'dark']), }; const sizes = [24, 32, 40, 48, 56, 72] as const; export const RTLDiff: Story = { render: () => ( <> {/* Badge positioning: bottom-right dot (notification/online) — key RTL indicator */}
{sizes.map((size) => ( ))}
{/* Online dot */}
{sizes.map((size) => ( ))}
{/* Badge with flag (bottom-right corner badge) */}
{sizes.map((size) => ( ))}
{/* Badge with icon */}
{sizes.map((size) => ( }}> ))}
{/* Badge type action with icon (camera) */}
{sizes.map((size) => ( }} /> ))}
{/* Badge type reference with icon */}
{sizes.map((size) => ( }} /> ))}
{/* Selected state (border highlight) */}
{sizes.map((size) => ( ))}
{/* Selected + badge combined */}
{sizes.map((size) => ( ))}
), ...withRTLDiff(), };