phanpy/src/components/modal.jsx

20 lines
438 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');
export default ({ children, onClick, class: className }) => {
if (!children) return null;
const Modal = (
<div className={className} onClick={onClick}>
{children}
</div>
);
return createPortal(Modal, $modalContainer);
// return createPortal(children, $modalContainer);
};