2020-06-04 14:01:31 +02:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
open: boolean;
|
|
|
|
onClose?: () => void;
|
|
|
|
title: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Dialog: React.FC<Props> = ({open, title, children, onClose = () => undefined}) => {
|
|
|
|
|
|
|
|
if (!open) {
|
|
|
|
return <></>;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
2021-01-23 11:53:00 +01:00
|
|
|
<div className="oc-dialog-dim" onClick={() => onClose()}> </div>
|
2020-06-16 17:02:50 +02:00
|
|
|
<div className="oc-dialog bbb-dialog" tabIndex={-1} role="dialog" style={{display:'inline-block', position: 'fixed'}}>
|
2020-06-04 14:01:31 +02:00
|
|
|
<h2 className="oc-dialog-title">{title}</h2>
|
|
|
|
<a className="oc-dialog-close" onClick={ev => {ev.preventDefault(); onClose();}}></a>
|
|
|
|
|
|
|
|
<div className="oc-dialog-content">
|
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Dialog;
|