klg-asutk-app/components/ui/Pagination.tsx

19 lines
614 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use client';
interface Props {
page: number;
pages: number;
onPageChange: (page: number) => void;
}
export default function Pagination({ page, pages, onPageChange }: Props) {
if (pages <= 1) return null;
return (
<div className="nav-pagination">
<button disabled={page <= 1} onClick={() => onPageChange(page - 1)} className="nav-btn"> Назад</button>
<span className="px-4 py-2 text-sm text-gray-600">Стр. {page} из {pages}</span>
<button disabled={page >= pages} onClick={() => onPageChange(page + 1)} className="nav-btn">Вперёд </button>
</div>
);
}