diff options
author | Joris | 2022-07-05 21:55:41 +0200 |
---|---|---|
committer | Joris | 2022-07-05 21:55:41 +0200 |
commit | accc3d9c67e004aa814d1592d97342d3a7766bb4 (patch) | |
tree | 3d50654383e0386f9dc22b8f0f586f928dd856d9 /src/lib/modal.ts | |
parent | 2936f06576997bffe7903ea840df563a408efc21 (diff) | |
download | map-accc3d9c67e004aa814d1592d97342d3a7766bb4.tar.gz map-accc3d9c67e004aa814d1592d97342d3a7766bb4.tar.bz2 map-accc3d9c67e004aa814d1592d97342d3a7766bb4.zip |
WIP Rewrite in TS
Diffstat (limited to 'src/lib/modal.ts')
-rw-r--r-- | src/lib/modal.ts | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/lib/modal.ts b/src/lib/modal.ts new file mode 100644 index 0000000..4f8c675 --- /dev/null +++ b/src/lib/modal.ts @@ -0,0 +1,28 @@ +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() + }, + h('div', { className: 'fa fa-close' }) + ), + content + ) + )) +} + +export function hide() { + const modal = document.querySelector('#g-Modal') + modal && document.body.removeChild(modal) +} |