import { DEFAULT_PAGE_SIZES, INITIAL_PAGE_INDEX } from "@/lib/hooks"; import { cn } from "@/lib/utils"; import { Button, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/ui"; import { Table } from "@tanstack/react-table"; import { t } from "i18next"; import { ChevronLeftIcon, ChevronRightIcon, ChevronsLeftIcon, ChevronsRightIcon, } from "lucide-react"; import { useMemo } from "react"; export type DataTablePaginationProps = { table: Table; className?: string; visible?: boolean | "auto"; }; export function DataTablePagination({ table, className, visible = "auto", }: DataTablePaginationProps) { const isVisible = useMemo(() => visible === true, [visible]); const isAuto = useMemo(() => visible === "auto", [visible]); if (!isVisible || (isAuto && table.getPageCount() < 1)) { return null; } return (
{t("common.rows_selected", { count: table.getFilteredSelectedRowModel().rows.length, total: table.getFilteredRowModel().rows.length, })}

{t("common.rows_per_page")}

{t("common.num_page_of_total", { count: table.getState().pagination.pageIndex + 1, total: table.getPageCount(), })}
); }