import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu" import { ButtonProps } from "@/components/ui/button" import { forwardRef, useState } from "react" import { IconButton } from "./xui/icon-button" import { toast } from "sonner"; interface NoteMenuProps extends ButtonProps { note: { private?: string, public?: string }; } export const NoteMenu = forwardRef((props, ref) => { const [copy, setCopy] = useState(false); const switchState = async (text?: string) => { if (!text) { toast("Warning", { description: "You didn't have any note." }) return; } if (!copy) { setCopy(true); await navigator.clipboard.writeText(text); setTimeout(() => { setCopy(false); }, 2 * 1000); } } return ( { switchState(props.note.private) }}>Private { switchState(props.note.public) }}>Public ); })