import Link from "next/link"; import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { ReactNode } from "react"; type OptionLink = { href: string; type: "link"; }; type OptionButton = { onClick: () => void; type: "button"; }; type Option = { label: string; } & (OptionLink | OptionButton); type DropDownMenuProps = { options: Option[]; children: ReactNode; }; export default function DropDownMenu({ children, options }: DropDownMenuProps) { return ( {children} {options.map((o) => { if (o.type === "button") { return ( ); } else { return ( {o.label} ); } })} ); }