Skip to content

Commit

Permalink
refactor: Change pagination behavior on Media Page
Browse files Browse the repository at this point in the history
  • Loading branch information
ErickLimaS committed Jul 4, 2024
1 parent d180dbe commit e61fcd8
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions app/media/[id]/components/PaginationButtons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,26 @@ type NavTypes = {
}

export default function PaginationButtons({ onPageChange, pageCount, redirectToPage }: NavTypes) {

const pageRange = (typeof window !== "undefined") && window.matchMedia("(max-width: 440px)").matches ? 1 : 4

return (
<ReactPaginate
nextLabel={<ChevronRightSvg alt="Icon to Right side" width={16} height={16} />}
nextLabel={
<ChevronRightSvg alt="Icon to Right side" width={16} height={16} />
}
previousLabel={
<ChevronLeftSvg alt="Icon to left side" width={16} height={16} />
}
onPageChange={onPageChange}
pageRangeDisplayed={(typeof window !== "undefined") && window.matchMedia("(max-width: 440px)").matches ? 1 : 2}
pageRangeDisplayed={pageRange}
marginPagesDisplayed={1}
pageCount={pageCount}
forcePage={redirectToPage || 0}
previousLabel={<ChevronLeftSvg alt="Icon to left side" width={16} height={16} />}
pageClassName={styles.li_item}
pageLinkClassName="page-link"
previousClassName={styles.previous_btn}
previousLinkClassName="page-link"
previousClassName={styles.previous_btn}
nextClassName={styles.next_btn}
nextLinkClassName="page-item"
breakLabel="..."
Expand Down

0 comments on commit e61fcd8

Please sign in to comment.