diff options
author | metamuffin <metamuffin@disroot.org> | 2022-09-10 00:56:25 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2022-09-10 00:56:25 +0200 |
commit | 429dc2d5375abf8ca9c3861bdc4bdff52a31b0e4 (patch) | |
tree | 2fa8201ebdf45237a9ec90429bd18b5d6cdd9944 /client-web/source/helper.ts | |
parent | 95041256f86745832df42423e889d50d2cff35e7 (diff) | |
download | keks-meet-429dc2d5375abf8ca9c3861bdc4bdff52a31b0e4.tar keks-meet-429dc2d5375abf8ca9c3861bdc4bdff52a31b0e4.tar.bz2 keks-meet-429dc2d5375abf8ca9c3861bdc4bdff52a31b0e4.tar.zst |
overlay rework + settings
Diffstat (limited to 'client-web/source/helper.ts')
-rw-r--r-- | client-web/source/helper.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/client-web/source/helper.ts b/client-web/source/helper.ts index b4eb20e..1d75b60 100644 --- a/client-web/source/helper.ts +++ b/client-web/source/helper.ts @@ -1,6 +1,7 @@ /// <reference lib="dom" /> + const elem = (s: string) => document.createElement(s) interface Opts { class?: string[] | string, id?: string } @@ -37,3 +38,19 @@ export const ediv = elem_with_children("div") export const espan = elem_with_content("span") export const elabel = elem_with_content("label") +export const OVERLAYS = ediv({ class: "overlays" }) + + +export class OverlayUi { + _shown = false + constructor(public el: HTMLElement, initial = false) { + this.shown = initial + } + get shown() { return this._shown } + set shown(v: boolean) { + if (v && !this._shown) OVERLAYS.append(this.el) + if (!v && this._shown) OVERLAYS.removeChild(this.el) + this._shown = v + } +} + |