import type { LucideIcon as IconType } from "lucide-react"; import type { FC } from "react"; import React from "react"; import type { ButtonBaseProps } from "../button"; import { Button } from "../button"; import { Dropdown, DropdownMenuContent, DropdownMenuItem, DropdownItem, DropdownMenuPortal, DropdownMenuTrigger, } from "../form/dropdown"; import { ChevronDown, MoreHorizontal } from "../icon"; export type ActionType = { id: string; icon?: IconType; iconClassName?: string; label: string; disabled?: boolean; color?: ButtonBaseProps["color"]; } & ( | { href: string; onClick?: never; actions?: never } | { href?: never; onClick: (e: React.MouseEvent) => void; actions?: never } | { actions?: ActionType[]; href?: never; onClick?: never } ); interface Props { actions: ActionType[]; } const defaultAction = (e: React.MouseEvent) => { e.stopPropagation(); }; export const DropdownActions = ({ actions, actionTrigger, }: { actions: ActionType[]; actionTrigger?: React.ReactNode; }) => { return ( {!actionTrigger ? ( ); if (!action.actions) { return button; } return ; })} ); };