diff --git a/frontend/app/components/Pagination.tsx b/frontend/app/components/Pagination.tsx new file mode 100644 index 000000000..c1857fcac --- /dev/null +++ b/frontend/app/components/Pagination.tsx @@ -0,0 +1,66 @@ +import React from 'react'; + +type PaginationProps = { + currentPage: number; + totalPages: number; + onPageChange: (page: number) => void; +}; + +const Pagination: React.FC = ({ currentPage, totalPages, onPageChange }) => { + if (totalPages <= 1) return null; + + const getPageNumbers = () => { + const delta = 2; + const pages: number[] = []; + + for (let i = Math.max(1, currentPage - delta); i <= Math.min(totalPages, currentPage + delta); i++) { + pages.push(i); + } + + return pages; + }; + + return ( +
+ + + {getPageNumbers().map((page) => ( + + ))} + + +
+ ); +}; + +export default Pagination;