"use client"; import { Button } from "@midday/ui/button"; import { cn } from "@midday/ui/cn"; import { TableHead, TableHeader, TableRow } from "@midday/ui/table"; import { ArrowDown, ArrowUp } from "lucide-react"; import { HorizontalPagination } from "@/components/horizontal-pagination"; import { useSortParams } from "@/hooks/use-sort-params"; interface Props { tableScroll?: { canScrollLeft: boolean; canScrollRight: boolean; isScrollable: boolean; scrollLeft: () => void; scrollRight: () => void; }; } export function DataTableHeader({ tableScroll }: Props) { const { params, setParams } = useSortParams(); const [column, value] = params.sort || []; const createSortQuery = (name: string) => { const [currentColumn, currentValue] = params.sort || []; if (name === currentColumn) { if (currentValue === "asc") { setParams({ sort: [name, "desc"] }); } else if (currentValue === "desc") { setParams({ sort: null }); } else { setParams({ sort: [name, "asc"] }); } } else { setParams({ sort: [name, "asc"] }); } }; return (
{tableScroll?.isScrollable && ( )}
Actions
); }