"use client"; import { Button } from "@/components/ui/button"; import { ChevronLeft, ChevronRight } from "lucide-react"; import { useRouter, useSearchParams, usePathname } from "next/navigation"; interface PaginationProps { currentPage: number; totalPages: number; total: number; } export function Pagination({ currentPage, totalPages, total, }: PaginationProps) { const router = useRouter(); const pathname = usePathname(); const searchParams = useSearchParams(); const createPageURL = (pageNumber: number) => { const params = new URLSearchParams(searchParams); params.set("page", pageNumber.toString()); return `${pathname}?${params.toString()}`; }; return (
Showing page {currentPage} of {totalPages} ({total} total items)
{/* Simple pagination logic: show max 5 pages */} {Array.from({ length: Math.min(5, totalPages) }, (_, i) => { // Logic to center current page could be added here for large page counts // For now, just showing first 5 or all if < 5 const pageNum = i + 1; return ( ); })}
); }