Pagination label is now cleaner

Signed-off-by: GregoireW <24318548+GregoireW@users.noreply.github.com>
This commit is contained in:
GregoireW
2021-05-07 19:23:09 +02:00
parent bc2cab231f
commit 6b1cf60c59
2 changed files with 6 additions and 9 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
'@backstage/plugin-org': patch
---
Display only first 50 group members
Paginate group members to only display 50 members maximum.
@@ -151,16 +151,13 @@ export const MembersListCard = (_props: {
return <ResponseErrorPanel error={error} />;
}
const nbPages = Math.ceil((members?.length || 0) / pageSize);
const paginationLabel = nbPages < 2 ? '' : `, page ${page} of ${nbPages}`;
return (
<Grid item>
<InfoCard
title={`Members (${members?.length || 0}) ${
members && members.length > pageSize
? ` (page ${page} of ${Math.ceil(
(members?.length || 0) / pageSize,
)})`
: ''
}`}
title={`Members (${members?.length || 0}${paginationLabel})`}
subheader={`of ${displayName}`}
>
<Grid container spacing={3}>
@@ -177,7 +174,7 @@ export const MembersListCard = (_props: {
)}
</Grid>
<Pagination
count={Math.ceil((members?.length || 0) / pageSize)}
count={nbPages}
page={page}
onChange={pageChange}
showFirstButton