"use client" import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react" import { Button } from "@/components/ui/button" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select" type ListPaginationProps = { page: number total: number limit: number loading?: boolean pageSizeOptions?: number[] onPageChange: (page: number) => void onLimitChange: (limit: number) => void } export function ListPagination({ page, total, limit, loading = false, pageSizeOptions = [10, 20, 50, 100], onPageChange, onLimitChange, }: ListPaginationProps) { const totalPages = Math.max(1, Math.ceil(total / limit)) const canGoPreviousPage = page > 1 const canGoNextPage = page < totalPages function handleLimitChange(value: string | null) { if (!value) { return } const nextLimit = Number(value) if (!Number.isInteger(nextLimit) || nextLimit <= 0 || nextLimit === limit) { return } onLimitChange(nextLimit) } return (
第 {page} 页 / 共 {totalPages} 页 共 {total} 条记录
) }