import { ReactNode } from 'react' import clsx from 'clsx' import { Spacer } from './layout/spacer' import { Row } from './layout/row' export function PaginationNextPrev(props: { className?: string prev?: ReactNode next?: ReactNode onClickPrev: () => void onClickNext: () => void scrollToTop?: boolean }) { const { className, prev, next, onClickPrev, onClickNext, scrollToTop } = props return ( {prev != null && ( {prev ?? 'Previous'} )} {next != null && ( {next ?? 'Next'} )} ) } export function Pagination(props: { page: number itemsPerPage: number totalItems: number setPage: (page: number) => void scrollToTop?: boolean className?: string nextTitle?: string prevTitle?: string }) { const { page, itemsPerPage, totalItems, setPage, scrollToTop, nextTitle, prevTitle, className, } = props const maxPage = Math.ceil(totalItems / itemsPerPage) - 1 if (maxPage <= 0) return return ( ) }