Skip to content

Commit dde87a3

Browse files
authored
Merge pull request #1798 from Mephistic/fix-testimony-pagination
Fixing pagination for Bill Details testimonies
2 parents 6c32735 + f099050 commit dde87a3

File tree

2 files changed

+4
-27
lines changed

2 files changed

+4
-27
lines changed

components/TestimonyCard/ViewTestimony.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,7 @@ const ViewTestimony = (
143143
))}
144144

145145
{(pagination.hasPreviousPage || pagination.hasNextPage) && (
146-
<PaginationButtons
147-
pagination={pagination}
148-
totalItems={totalTestimonies}
149-
/>
146+
<PaginationButtons pagination={pagination} />
150147
)}
151148
</div>
152149
) : (

components/table/PaginationButtons.tsx

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import {
2-
faAngleLeft,
3-
faAngleRight,
42
faAngleDoubleLeft,
53
faAngleDoubleRight
64
} from "@fortawesome/free-solid-svg-icons"
@@ -16,21 +14,13 @@ export const PaginationButtons = ({
1614
nextPage,
1715
hasNextPage,
1816
previousPage,
19-
hasPreviousPage,
20-
itemsPerPage
21-
},
22-
totalItems
17+
hasPreviousPage
18+
}
2319
}: {
2420
pagination: Pagination
25-
totalItems: number | undefined
2621
}) => {
2722
const { t } = useTranslation("common")
2823

29-
if (totalItems === undefined) {
30-
return null
31-
}
32-
let currentPageEnd = Math.min(currentPage * itemsPerPage, totalItems)
33-
3424
return (
3525
<div className="d-flex justify-content-center my-3">
3626
<PreviousStyle
@@ -43,23 +33,13 @@ export const PaginationButtons = ({
4333
<SpanStyle variant="secondary" className="align-self-center">
4434
{t("table.page", { currentPage })}
4535
</SpanStyle>
46-
<NextStyle
47-
variant="secondary"
48-
onClick={nextPage}
49-
disabled={!hasNextPage || currentPageEnd >= totalItems}
50-
>
36+
<NextStyle variant="secondary" onClick={nextPage} disabled={!hasNextPage}>
5137
<FontAwesomeIcon icon={faAngleDoubleRight} />
5238
</NextStyle>
5339
</div>
5440
)
5541
}
5642

57-
const SetPageStyle = styled(Button)`
58-
font-family: nunito;
59-
background-color: #1a3185;
60-
margin: 2px;
61-
border-radius: 0;
62-
`
6343
const SpanStyle = styled(Button)`
6444
background-color: #1a3185;
6545
color: white;

0 commit comments

Comments
 (0)