Skip to content

Commit

Permalink
[BOOKINGSG-4633][SR] empty view update
Browse files Browse the repository at this point in the history
  • Loading branch information
SasithaRajapakasha committed Sep 4, 2023
1 parent 5693630 commit d6cbe7b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/data-table/data-table.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,7 @@ export const ErrorDisplayElement = styled(ErrorDisplay)`
margin-top: 1rem;
}
`;

export const EmptyViewCell = styled.td`
padding: 4rem 0;
`;
5 changes: 3 additions & 2 deletions src/data-table/data-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
BodyCellContent,
BodyRow,
CheckBoxWrapper,
EmptyViewCell,
ErrorDisplayElement,
HeaderCell,
HeaderCellWrapper,
Expand Down Expand Up @@ -150,11 +151,11 @@ export const DataTable = ({
const renderRows = () => {
return rows?.length < 1 ? (
<tr>
<td colSpan={getTotalColumns()}>
<EmptyViewCell colSpan={getTotalColumns()}>
{renderCustomEmptyView
? renderCustomEmptyView()
: renderBasicEmptyView()}
</td>
</EmptyViewCell>
</tr>
) : (
<>
Expand Down
4 changes: 4 additions & 0 deletions stories/data-table/data-table.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ Table Empty Data View.
description: "This is Placeholder text",
actionButton: {
children: "Trigger",
styleType: "secondary",
style: {
width: "5rem",
},
onClick: () => {
alert("Clicked on Trigger button");
},
Expand Down

0 comments on commit d6cbe7b

Please sign in to comment.