import { Fragment, ReactNode } from "react"; import { Menu, Transition } from "@headlessui/react"; import clsx from "clsx"; import OptionsIcon from "../icons/OptionsIcon"; import { Link } from "react-router"; interface Props { items?: ( | { label: string; onClick: () => void; } | { label: string; href: string; target?: "_blank" | string; } )[]; button?: ReactNode; disabled?: boolean; className?: string; width?: "w-48" | "w-56" | "w-64" | "w-72" | "w-80" | "w-96"; right?: boolean; } export default function DropdownSimple({ items, button, disabled, className, right, width = "w-48" }: Props) { return (
{button ?? }
{items?.map((item, i) => { return ( {({ active, close }) => { return ( {"href" in item ? ( close()} > {item.label} ) : ( )} ); }} ); })}
); }