Skip to content

Commit

Permalink
feat(table): add logic to paint free rows (#105)
Browse files Browse the repository at this point in the history
* feat(table): add new variant and property in table component

* feat(table): fixs from comments

* feat(table): fixs from comment
  • Loading branch information
malegreIndec authored Feb 6, 2024
1 parent c932582 commit 930cd78
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/components/Table/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,15 @@ const Table = ({
)}
{!isLoading && data.length > 0 && buildRows(data, columnsData).map(row => (
<Tr key={row?.key} {...row?.containerStyle} data-testid={`row-${row?.key}`}>
{columnsData.map(header => (
<Td key={`${row.key}-${header.key}`} {...row.style} {...header.tdStyle} >
{row[header.key]}
</Td>
))}
{columnsData.map(header => {
const isEmpty = row[header.key] == null || row[header.key] === '';
const rowStyle = isEmpty ? header.emptyRow : header.tdStyle;
return (
<Td key={`${row.key}-${header.key}`} {...row.style} {...rowStyle}>
{row[header.key]}
</Td>
);
})}
</Tr>
))}
</Tbody>
Expand Down

0 comments on commit 930cd78

Please sign in to comment.