import { Dialog, Transition } from "@headlessui/react"; import { Button } from "~/components/Button"; import { Fragment, useCallback } from "react"; import { DoNotShow } from "~/pages/PageEnigma/constants/misc"; interface Props { text: string; title: string; open: boolean; onClose: () => void; onOk?: () => void; okText?: string; okColor?: string; onCancel?: () => void; cancelText?: string; canHide?: boolean; } export const ConfirmationModal = ({ text, title, open, onClose, onOk, okText = "OK", okColor = "bg-brand-success", onCancel, cancelText = "Cancel", canHide, }: Props) => { const handleOk = useCallback(() => { const element = document.getElementById("can-delete"); if (element) { if ((element as HTMLInputElement).checked) { localStorage.setItem(title.replace(" ", "-"), DoNotShow); } } onOk!(); }, [onOk, title]); return (
{title}
{text}
{canHide && (
)}
{!!onCancel && ( )} {!!onOk && ( )}
); };