import { ChevronDownIcon, DotsHorizontalIcon } from "@heroicons/react/solid"; import React, { FC } from "react"; import Button from "@calcom/ui/Button"; import Dropdown, { DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from "@calcom/ui/Dropdown"; import { SVGComponent } from "@lib/types/SVGComponent"; export type ActionType = { id: string; icon?: SVGComponent; label: string; disabled?: boolean; color?: "primary" | "secondary"; } & ({ href?: never; onClick: () => any } | { href?: string; onClick?: never }) & { actions?: ActionType[]; }; interface Props { actions: ActionType[]; } const DropdownActions = ({ actions, actionTrigger }: { actions: ActionType[]; actionTrigger?: any }) => { return ( {!actionTrigger ? ( ) : ( {actionTrigger} )} {actions.map((action) => ( ))} ); }; const TableActions: FC = ({ actions }) => { const mobileActions = actions.flatMap((action) => { if (action.actions) { return action.actions; } return action; }); return ( <>
{actions.map((action) => { const button = ( ); if (!action.actions) { return button; } return ; })}
); }; export default TableActions;