templates2.Content.Next/components/content/PagePagination.tsx
w4c-templates 3caefb8833
Some checks are pending
CI / quality (push) Waiting to run
chore(template): publish Content.Next
2026-10-11 23:29:57 +03:00

30 lines
851 B
TypeScript

import Link from 'next/link';
/** Pagination controls for a list route that reads `?page=`. */
export function PagePagination({ page, pages, basePath }: { page: number; pages: number; basePath: string }) {
if (pages <= 1) return null;
const prev = page > 1 ? `${basePath}?page=${page - 1}` : null;
const next = page < pages ? `${basePath}?page=${page + 1}` : null;
return (
<nav className="mt-10 flex items-center justify-between text-sm" aria-label="Pagination">
{prev ? (
<Link href={prev} className="btn-secondary">
Previous
</Link>
) : (
<span />
)}
<span className="muted">
Page {page} of {pages}
</span>
{next ? (
<Link href={next} className="btn-secondary">
Next
</Link>
) : (
<span />
)}
</nav>
);
}