Skip to content

Commit

Permalink
Merge branch 'bugfix/unsuccessfullResult-in-row-rendering' into q/1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bert-e committed Jul 2, 2024
2 parents fcc3d51 + 7b55cf9 commit 0e2fb8b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/lib/components/UnsuccessfulResult.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Text } from './text/Text.component';
import { Box } from './box/Box';
import { spacing } from '../spacing';

const NoResult = styled(Box)<{ height: number | string }>`
export const NoResult = styled(Box)<{ height: number | string }>`
display: flex;
justify-content: center;
align-items: center;
Expand Down
43 changes: 29 additions & 14 deletions src/lib/components/tablev2/TableCommon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,30 @@ export function TableRows<
/>
);
}

if (status === 'success' || status === undefined) {
if (typeof children === 'function') {
return children(
<VirtualizedRows
rows={rows}
listRef={bodyRef}
itemKey={itemKey}
rowHeight={rowHeight}
setHasScrollbar={setHasScrollbar}
onBottom={onBottom}
onBottomOffset={onBottomOffset}
RenderRow={RenderRow}
/>,
);
if (rows.length) {
return children(
<VirtualizedRows
rows={rows}
listRef={bodyRef}
itemKey={itemKey}
rowHeight={rowHeight}
setHasScrollbar={setHasScrollbar}
onBottom={onBottom}
onBottomOffset={onBottomOffset}
RenderRow={RenderRow}
/>,
);
} else {
return children(
<UnsuccessfulResult
rowHeight={rowHeight}
name={entityName}
status="noResult"
/>,
);
}
} else if (rows.length) {
return (
<VirtualizedRows
Expand All @@ -176,7 +185,13 @@ export function TableRows<
/>
);
} else {
return <UnsuccessfulResult name={entityName} status="noResult" />;
return (
<UnsuccessfulResult
rowHeight={rowHeight}
name={entityName}
status="noResult"
/>
);
}
}

Expand Down

0 comments on commit 0e2fb8b

Please sign in to comment.