mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-27 02:56:22 +01:00
20 lines
438 B
React
20 lines
438 B
React
|
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);
|
||
|
};
|