Files
EpicNext-Cms/src/components/admin/admin-simple-pager.tsx
T
Simo b1ddda66ff
CI / check (push) Successful in 27s
CI / release (push) Skipped
CI / deploy (push) Successful in 43s
Revert "Merge pull request 'Complete Housekeeping migration and /ase cutover' (#52) from codex/housekeeping-complete into main"
This reverts commit 488b6e57c4, reversing
changes made to b506b4499a.
2026-08-30 21:31:34 +02:00

53 lines
1.2 KiB
TypeScript

import Link from "@/components/link";
/** Minimal prev/next pager for admin list pages without DataTable. */
export function AdminSimplePager({
page,
lastPage,
total,
basePath,
params,
label,
}: {
page: number;
lastPage: number;
total: number;
basePath: string;
/** Extra query params preserved across pages (e.g. filter=sold). */
params?: Record<string, string>;
label?: string;
}) {
if (lastPage <= 1) return null;
const href = (p: number) => {
const u = new URLSearchParams(params);
u.set("page", String(p));
return `${basePath}?${u.toString()}`;
};
return (
<div className="mt-3 flex flex-wrap items-center justify-between gap-2 text-sm text-[var(--admin-text-muted)]">
<span>
{label ? `${label} · ` : null}
{total} total · page {page}/{lastPage}
</span>
<div className="flex items-center gap-2">
{page > 1 ? (
<Link className="btn btn-ghost btn-sm" href={href(page - 1)}>
Previous
</Link>
) : (
<span className="opacity-40">Previous</span>
)}
{page < lastPage ? (
<Link className="btn btn-ghost btn-sm" href={href(page + 1)}>
Next
</Link>
) : (
<span className="opacity-40">Next</span>
)}
</div>
</div>
);
}