31 lines
856 B
TypeScript
Executable File
31 lines
856 B
TypeScript
Executable File
import { h, Component } from 'preact';
|
|
import "./modal.scss"
|
|
|
|
|
|
export class Modal extends Component<{ title: string, onClose?: () => void, noClose?: boolean }, {}> {
|
|
constructor(props) {
|
|
super(props);
|
|
}
|
|
|
|
render() {
|
|
return <div class="modal_container" onClick={(evt) => {
|
|
let path = evt.composedPath();
|
|
if (!path.find(e => {
|
|
let res = false;
|
|
let s = (e as Element);
|
|
if (s) {
|
|
if (s.classList) {
|
|
res = s.classList.contains("card")
|
|
}
|
|
}
|
|
return res;
|
|
}))
|
|
if (this.props.onClose) this.props.onClose();
|
|
}}>
|
|
<div class="card" >
|
|
<h3 class="section">{this.props.title}</h3>
|
|
{this.props.children}
|
|
</div>
|
|
</div>
|
|
}
|
|
} |