import { Meta, StoryObj } from '@storybook/react-webpack5'; import { IntlProvider } from 'react-intl'; import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator'; import { getDirectionFromLocale, Typography } from '../../common'; import type { DisplayTypes } from '../../common/PropsValues/typography'; import Money from '../../Money/Money'; import Title from '../../Title/Title'; import Display from '../Display'; const meta: Meta = { component: Display, tags: ['!autodocs', '!manifest'], title: 'Typography/Display/Tests', }; export default meta; type Story = StoryObj; export const RTLDiff: Story = { render: () => { return ( <>
Display Number Small
Display Number Medium
Display Number Large
Display Number (Deprecated)
); }, ...withRTLDiff({ fixedRows: { heights: 'auto' } }), }; const LOCALES = [ { value: 'fr', label: 'Other Latin' }, { value: 'ru', label: 'Cyrillic' }, { value: 'el', label: 'Greek' }, { value: 'ja', label: 'Japanese' }, { value: 'ko', label: 'Korean' }, { value: 'th', label: 'Thai' }, { value: 'zh-CN', label: 'Chinese' }, { value: 'ar', label: 'Arabic' }, { value: 'he', label: 'Hebrew' }, ]; // `lang` picks the locale's typography tokens, IntlProvider the locale's number formatting const renderAllLocales = (type: DisplayTypes) => ( <> {LOCALES.map(({ value, label }) => (
{label}
))} ); export const DisplayNumberSmallLocales: Story = { render: () => renderAllLocales(Typography.DISPLAY_NUMBER_SMALL), }; export const DisplayNumberMediumLocales: Story = { render: () => renderAllLocales(Typography.DISPLAY_NUMBER_MEDIUM), }; export const DisplayNumberLargeLocales: Story = { render: () => renderAllLocales(Typography.DISPLAY_NUMBER_LARGE), }; export const DisplayNumberDeprecatedLocales: Story = { render: () => renderAllLocales(Typography.DISPLAY_NUMBER), };