Skip to content

Commit

Permalink
safer data typing for rowa
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamwasp committed Jan 24, 2025
1 parent 31b31c7 commit 0e23544
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/gamut/src/DataList/Tables/Rows/TableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
useMemo,
} from 'react';

import { Box, Text } from '../../..';
import { Text } from '../../..';
import { ListCol, ListRow } from '../../../List';
import { ColProps } from '../../../List/elements';
import { Shimmer } from '../../../Loading/Shimmer';
Expand Down Expand Up @@ -115,22 +115,22 @@ export const TableRow: DataRow = ({

return (
<ListCol {...colProps} key={newKey}>
{!row ? (
''
) : render ? (
{render ? (
render(row)
) : typeof row[key] === 'string' || typeof row[key] === 'number' ? (
<Text
truncate="ellipsis"
truncateLines={1}
textAlign={justify ?? 'left'}
>
{row[key]}
{row[key] as string}
</Text>
) : isValidElement(row[key]) ? (
row[key]
(row[key] as ReactElement)
) : !row[key] ? (
''
) : (
'Data type error'
'Invalid data type'
)}
</ListCol>
);
Expand Down

0 comments on commit 0e23544

Please sign in to comment.