import { Dialog } from "@headlessui/react"; import { AnimatePresence, motion } from "framer-motion"; import * as React from "react"; import Button, { ButtonProps } from "../button"; export interface ModalProps { description?: React.ReactNode; title?: React.ReactNode; okText?: string; cancelText?: string; okButtonProps?: ButtonProps; onOk?: () => void; onCancel?: () => void; footer?: React.ReactNode; content?: React.ReactNode; overlayClosable?: boolean; visible?: boolean; } const Modal: React.VoidFunctionComponent = ({ description, title, okText, cancelText, okButtonProps, footer, content, overlayClosable, onCancel, onOk, visible, }) => { const initialFocusRef = React.useRef(null); return ( {visible ? ( { if (overlayClosable) onCancel?.(); }} > {content ?? (
{title ? {title} : null} {description ? ( {description} ) : null}
)} {footer ?? (
{cancelText ? ( ) : null} {okText ? ( ) : null}
)}
) : null}
); }; export default Modal;