import type { Table } from "@tanstack/react-table"; import { Fragment } from "react"; import type { SVGComponent } from "@calcom/types/SVGComponent"; import { Button } from "../button"; export type ActionItem = | { type: "action"; label: string; onClick: () => void; icon?: SVGComponent; } | { type: "render"; render: (table: Table) => React.ReactNode; }; interface DataTableSelectionBarProps { table: Table; actions?: ActionItem[]; } export function DataTableSelectionBar({ table, actions }: DataTableSelectionBarProps) { const numberOfSelectedRows = table.getSelectedRowModel().rows.length; if (numberOfSelectedRows === 0) return null; return (
{numberOfSelectedRows} selected
{actions?.map((action, index) => ( {action.type === "action" ? ( ) : action.type === "render" ? ( action.render(table) ) : null} ))}
); }