import { Menu, Transition } from "@headlessui/react"; import { DotsHorizontalIcon } from "@heroicons/react/solid"; import React, { FC, Fragment } from "react"; import classNames from "@lib/classNames"; import { SVGComponent } from "@lib/types/SVGComponent"; import Button from "./Button"; type ActionType = { id: string; icon: SVGComponent; label: string; disabled?: boolean; color?: "primary" | "secondary"; } & ({ href?: never; onClick: () => any } | { href: string; onClick?: never }); interface Props { actions: ActionType[]; } const TableActions: FC = ({ actions }) => { return ( <>
{actions.map((action) => ( ))}
{({ open }) => ( <>
Open options
{actions.map((action) => { const Element = typeof action.onClick === "function" ? "span" : "a"; return ( {({ active }) => ( )} ); })}
)}
); }; export default TableActions;