1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: conditionally show pagination bar

This commit is contained in:
Fredrik Oseberg 2023-11-13 14:47:51 +01:00
parent 834ae1d8a4
commit 0f7360c1e8
No known key found for this signature in database
GPG Key ID: 816A423246CADD4E
2 changed files with 21 additions and 6 deletions

View File

@ -109,7 +109,7 @@ export const PageContent: FC<IPageContentProps> = ({
); );
if (disableLoading) { if (disableLoading) {
return content; return <div>{content}</div>;
} }
return ( return (

View File

@ -501,14 +501,23 @@ export const PaginatedProjectFeatureToggles = ({
isFavoritesPinned, isFavoritesPinned,
]); ]);
const showPaginationBar = Boolean(total && total > 25);
const style = showPaginationBar
? { borderBottomLeftRadius: 0, borderBottomRightRadius: 0 }
: {};
return ( return (
<> <>
<PageContent <PageContent
disableLoading disableLoading
className={styles.container} className={styles.container}
sx={{ borderBottomLeftRadius: 0, borderBottomRightRadius: 0 }} sx={style}
header={ header={
<div ref={headerLoadingRef}> <div
ref={headerLoadingRef}
aria-busy={initialLoad}
aria-live='polite'
>
<PageHeader <PageHeader
titleElement={ titleElement={
showTitle showTitle
@ -615,7 +624,11 @@ export const PaginatedProjectFeatureToggles = ({
</div> </div>
} }
> >
<div ref={bodyLoadingRef}> <div
ref={bodyLoadingRef}
aria-busy={loading}
aria-live='polite'
>
<SearchHighlightProvider value={getSearchText(searchValue)}> <SearchHighlightProvider value={getSearchText(searchValue)}>
<VirtualizedTable <VirtualizedTable
rows={rows} rows={rows}
@ -692,8 +705,10 @@ export const PaginatedProjectFeatureToggles = ({
{featureToggleModals} {featureToggleModals}
</div> </div>
</PageContent> </PageContent>
<ConditionallyRender
{paginationBar} condition={showPaginationBar}
show={paginationBar}
/>
<BatchSelectionActionsBar <BatchSelectionActionsBar
count={Object.keys(selectedRowIds).length} count={Object.keys(selectedRowIds).length}
> >