import type { Meta, StoryObj } from '@storybook/react-webpack5'; import { DirectDebits } from '@transferwise/icons'; import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator'; import Table from '..'; import { TableHeaderType } from '../Header/TableHeader'; import { TableRowType, TableRowClickableType } from '../Row/TableRow'; export default { component: Table, title: 'Content/Table/Tests', tags: ['!autodocs', '!manifest'], } satisfies Meta; type Story = StoryObj; export const RTLDiff: Story = { render: () => { const i18n = useRtlDiffI18n(); const headers: TableHeaderType[] = [ { header: i18n.employeeHeader, width: '200px' }, { header: i18n.locationHeader }, { header: i18n.paymentHeader, alignment: 'right' }, { header: i18n.statusHeader }, ]; const rows: TableRowType[] = [ { cells: [ { cell: { type: 'leading', primaryText: i18n.employeeOneName, secondaryText: i18n.employeeOneRole, avatar: { profileName: i18n.employeeOneName, badge: { flagCode: 'GBP' } }, }, }, { cell: { type: 'text', text: i18n.employeeOneLocation } }, { cell: { type: 'currency', primaryCurrency: { amount: 12345.67, currency: 'eur' }, secondaryCurrency: { amount: 11000.0, currency: 'gbp' }, }, alignment: 'right', }, { cell: { type: 'status', primaryText: i18n.employeeOneStatus, secondaryText: i18n.employeeOneStatusTime, sentiment: 'negative', }, }, ], }, { cells: [ { cell: { type: 'leading', primaryText: i18n.employeeTwoName, secondaryText: i18n.employeeTwoRole, avatar: { asset: , badge: { status: 'warning' } }, }, }, { cell: { type: 'text', text: i18n.employeeTwoLocation } }, { cell: { type: 'currency', primaryCurrency: { amount: 23456.78, currency: 'usd' }, secondaryCurrency: { amount: 21000.0, currency: 'gbp' }, }, alignment: 'right', }, { cell: { type: 'status', primaryText: i18n.employeeTwoStatus, secondaryText: i18n.employeeTwoStatusTime, sentiment: 'positive', }, }, ], }, ]; return ( <>
{ void rowData; }, }} />
); }, ...withRTLDiff({ fixedRows: { heights: 'auto' }, i18n: { employeeHeader: { en: 'Employee', ar: 'الموظف' }, locationHeader: { en: 'Location', ar: 'الموقع' }, paymentHeader: { en: 'Payment', ar: 'الدفعة' }, statusHeader: { en: 'Status', ar: 'الحالة' }, employeeOneName: { en: 'Bob Brown', ar: 'بوب براون' }, employeeOneRole: { en: 'Software Engineer', ar: 'مهندس برمجيات' }, employeeOneLocation: { en: 'FR, Paris', ar: 'فرنسا، باريس' }, employeeOneStatus: { en: 'Cancelled', ar: 'ملغى' }, employeeOneStatusTime: { en: '1 day ago', ar: 'منذ يوم واحد' }, employeeTwoName: { en: 'Jan Kowalski', ar: 'يان كوفالسكي' }, employeeTwoRole: { en: 'Product Manager', ar: 'مدير المنتج' }, employeeTwoLocation: { en: 'US, New York', ar: 'أمريكا، نيويورك' }, employeeTwoStatus: { en: 'Paid', ar: 'مدفوع' }, employeeTwoStatusTime: { en: 'Yesterday', ar: 'أمس' }, }, }), };