First alpha
This commit is contained in:
31
src/components/modals/Modal.tsx
Executable file
31
src/components/modals/Modal.tsx
Executable file
@ -0,0 +1,31 @@
|
||||
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>
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user