Skip to content

Commit

Permalink
fix: conditionally show pagination bar
Browse files Browse the repository at this point in the history
  • Loading branch information
FredrikOseberg committed Nov 13, 2023
1 parent 834ae1d commit 0f7360c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion frontend/src/component/common/PageContent/PageContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const PageContent: FC<IPageContentProps> = ({
);

if (disableLoading) {
return content;
return <div>{content}</div>;
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,14 +501,23 @@ export const PaginatedProjectFeatureToggles = ({
isFavoritesPinned,
]);

const showPaginationBar = Boolean(total && total > 25);
const style = showPaginationBar
? { borderBottomLeftRadius: 0, borderBottomRightRadius: 0 }
: {};

return (
<>
<PageContent
disableLoading
className={styles.container}
sx={{ borderBottomLeftRadius: 0, borderBottomRightRadius: 0 }}
sx={style}
header={
<div ref={headerLoadingRef}>
<div
ref={headerLoadingRef}
aria-busy={initialLoad}
aria-live='polite'
>
<PageHeader
titleElement={
showTitle
Expand Down Expand Up @@ -615,7 +624,11 @@ export const PaginatedProjectFeatureToggles = ({
</div>
}
>
<div ref={bodyLoadingRef}>
<div
ref={bodyLoadingRef}
aria-busy={loading}
aria-live='polite'
>
<SearchHighlightProvider value={getSearchText(searchValue)}>
<VirtualizedTable
rows={rows}
Expand Down Expand Up @@ -692,8 +705,10 @@ export const PaginatedProjectFeatureToggles = ({
{featureToggleModals}
</div>
</PageContent>

{paginationBar}
<ConditionallyRender
condition={showPaginationBar}
show={paginationBar}
/>
<BatchSelectionActionsBar
count={Object.keys(selectedRowIds).length}
>
Expand Down

0 comments on commit 0f7360c

Please sign in to comment.