import { ReactNode } from "react"; import { MdChevronLeft, MdChevronRight } from "react-icons/md"; export default function Pagination({ page, setPage, totalPages, }: { page: number; setPage: (page: number) => void; totalPages: number; }) { const items: ReactNode[] = []; if (page > 1) { items.push( , ); } if (page - 2 > 1) { items.push( , ); } if (page - 1 > 1) { items.push( , ); } items.push( , ); if (page + 1 < totalPages) { items.push( , ); } if (page + 2 < totalPages) { items.push( , ); } if (page < totalPages) { items.push( , ); } return (
{items}
); }