phanpy/src/components/modal.jsx

22 lines
456 B
React
Raw Normal View History

2022-12-10 12:14:48 +03:00
import './modal.css';
import { createPortal } from 'preact/compat';
const $modalContainer = document.getElementById('modal-container');
2022-12-16 08:27:04 +03:00
function Modal({ children, onClick, class: className }) {
2022-12-10 12:14:48 +03:00
if (!children) return null;
const Modal = (
<div className={className} onClick={onClick}>
{children}
</div>
);
return createPortal(Modal, $modalContainer);
// return createPortal(children, $modalContainer);
2022-12-16 08:27:04 +03:00
}
export default Modal;