import { useCallback, useMemo, useState } from 'react';
import * as React from 'react';
import Modal from '../ui/Modal';
export default function useModal() {
    const [modalContent, setModalContent] = useState(null);
    const onClose = useCallback(() => {
        setModalContent(null);
    }, []);
    const modal = useMemo(() => {
        if (modalContent === null) {
            return null;
        }
        const { closeOnClickOutside, content, title } = modalContent;
        return (React.createElement(Modal, { closeOnClickOutside: closeOnClickOutside, onClose: onClose, title: title }, content));
    }, [modalContent, onClose]);
    const showModal = useCallback((title, 
    // eslint-disable-next-line no-shadow
    getContent, closeOnClickOutside = false) => {
        setModalContent({
            closeOnClickOutside,
            content: getContent(onClose),
            title,
        });
    }, [onClose]);
    return [modal, showModal];
}
//# sourceMappingURL=useModal.js.map