sendou.ink/app/components/Pagination.tsx
Kalle dd1adad94b
Some checks are pending
Tests and checks on push / run-checks-and-tests (push) Waiting to run
Updates translation progress / update-translation-progress-issue (push) Waiting to run
BIome v2 upgrade
2025-06-22 16:49:27 +03:00

56 lines
1.4 KiB
TypeScript

import clsx from "clsx";
import { SendouButton } from "~/components/elements/Button";
import { ArrowLeftIcon } from "~/components/icons/ArrowLeft";
import { ArrowRightIcon } from "~/components/icons/ArrowRight";
import { nullFilledArray } from "~/utils/arrays";
export function Pagination({
currentPage,
pagesCount,
nextPage,
previousPage,
setPage,
}: {
currentPage: number;
pagesCount: number;
nextPage: () => void;
previousPage: () => void;
setPage: (page: number) => void;
}) {
return (
<div className="pagination__container">
<SendouButton
icon={<ArrowLeftIcon />}
variant="outlined"
className="fix-rtl"
isDisabled={currentPage === 1}
onPress={previousPage}
aria-label="Previous page"
/>
<div className="pagination__dots">
{nullFilledArray(pagesCount).map((_, i) => (
// biome-ignore lint/a11y/noStaticElementInteractions: Biome v2 migration
<div
key={i}
className={clsx("pagination__dot", {
pagination__dot__active: i === currentPage - 1,
})}
onClick={() => setPage(i + 1)}
/>
))}
</div>
<div className="pagination__page-count">
{currentPage}/{pagesCount}
</div>
<SendouButton
icon={<ArrowRightIcon />}
variant="outlined"
className="fix-rtl"
isDisabled={currentPage === pagesCount}
onPress={nextPage}
aria-label="Next page"
/>
</div>
);
}