import { Dialog } from "@headlessui/react"; import { AnimatePresence, motion } from "framer-motion"; import * as React from "react"; import X from "@/components/icons/x.svg"; 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; showClose?: boolean; } const Modal: React.VoidFunctionComponent = ({ description, title, okText, cancelText, okButtonProps, footer, content, overlayClosable, onCancel, onOk, visible, showClose, }) => { const initialFocusRef = React.useRef(null); return ( {visible ? ( { if (overlayClosable) onCancel?.(); }} >
{showClose ? ( ) : null} {content ?? (
{title ? ( {title} ) : null} {description ? ( {description} ) : null}
)} {footer === undefined ? (
{cancelText ? ( ) : null} {okText ? ( ) : null}
) : null}
) : null}
); }; export default Modal;