all repos — onyx @ main

minimal map annotation and location data sharing tool

src/21-cancelModal.ts (raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class CancelModal implements Modal {
  self(): HTMLElement | null {
    return document.getElementById("cancel-container");
  }
  
  cancelMsg(): HTMLElement | null {
    return document.getElementById("cancel-msg");
  }
  
  cancelBtn(): HTMLElement | null {
    return document.getElementById("cancel-btn");
  }
  
  visible(): boolean {
    return this.self()?.style.display != "none";
  }
  
  setVisible(v: boolean): void {
    const modal = this.self();
    if (modal) {
      modal.style.display = v ? "block" : "none";
    }
  }
  
  setMsg(s: string): void {
    const msg = this.cancelMsg();
    if (msg) {
      msg.innerText = s;
    }
  }
}