import { useRef } from 'react';
const useClickOverlay = ({ onClose }) => {
    const modalContentRef = useRef(null);
    const handleOverlayClick = (event) => {
        var _a;
        // check clicks on parents of ModalContent
        if ((_a = event.target) === null || _a === void 0 ? void 0 : _a.contains(modalContentRef.current)) {
            onClose === null || onClose === void 0 ? void 0 : onClose(event);
        }
    };
    return { handleOverlayClick, modalContentRef };
};
export default useClickOverlay;
