'use client' import { Pagination as HeroPagination } from '@heroui/react' interface PaginationProps { className?: string color?: string isCompact?: boolean page: number showControls?: boolean showShadow?: boolean total: number onChange: (page: number) => void } function visiblePages(page: number, total: number): number[] { const start = Math.max(1, Math.min(page - 2, total - 4)) const end = Math.min(total, start + 4) return Array.from({ length: Math.max(0, end - start + 1) }, (_, index) => start + index) } export function Pagination({ className, page, showControls = true, total, onChange }: PaginationProps) { const pages = visiblePages(page, total) return ( {showControls ? ( { onChange(page - 1) }} > ‹ ) : null} {pages.map((item) => ( { onChange(item) }} > {item} ))} {showControls ? ( = total} onPress={() => { onChange(page + 1) }} > › ) : null} ) }