Skip to content

Commit

Permalink
fixed pagination of less than 3 pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabricevladimir committed Oct 25, 2023
1 parent 87639d2 commit e923e0f
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/@aragon/ods-old/components/pagination/pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,33 @@ export const Pagination: React.FC<PaginationProps> = ({
const {isMobile} = useScreen();

if (isMobile) {
if (totalPages - page <= 1) {
if (totalPages === 2) {
return (
<>
<ButtonText
mode="secondary"
size="large"
isActive={page === 1}
onClick={() => setPage(1)}
{...(bgWhite && {bgWhite})}
label={`${1}`}
key={1}
/>

<ButtonText
mode="secondary"
size="large"
isActive={page === 2}
onClick={() => setPage(2)}
{...(bgWhite && {bgWhite})}
label={`${2}`}
key={2}
/>
</>
);
}

if (totalPages - page <= 1 && totalPages > 2) {
const penultimatePage = totalPages - 1;
return (
<>
Expand Down

0 comments on commit e923e0f

Please sign in to comment.