import { h } from 'lib/h' import * as Button from 'lib/button' export function show(content: Element) { document.body.appendChild(h('div', { id: 'g-Modal' }, h('div', { className: 'g-Modal__Curtain', onclick: () => hide() } ), h('div', { className: 'g-Modal__Window' }, Button.raw( { className: 'g-Modal__Close', onclick: () => hide() }, 'x' ), content ) )) } export function hide() { const modal = document.querySelector('#g-Modal') modal && document.body.removeChild(modal) }