import Link from 'next/link'; import { cn } from '@/lib/cn'; import { fmtInt } from '@/lib/format'; /** URL-driven pagination (server component). `makeHref(offset)` builds the link preserving current filters. */ export function Pagination({ total, limit, offset, makeHref, className }: { total: number; limit: number; offset: number; makeHref: (offset: number) => string; className?: string }) { const pages = Math.max(1, Math.ceil(total / limit)); const page = Math.floor(offset / limit) + 1; if (pages <= 1) return
{fmtInt(total)} results
; const from = offset + 1; const to = Math.min(total, offset + limit); const btn = 'inline-flex h-10 min-w-10 items-center justify-center border border-rule px-3 text-sm text-ink-2 hover:bg-surface-2 hover:text-ink'; return ( ); } /** Build a query-string href preserving existing params. */ export function withParams(base: string, current: Record