First working plantnet UI

This commit is contained in:
Pieter Vander Vennet 2022-08-22 19:16:37 +02:00
parent a8959fc934
commit 06f8cf7006
9 changed files with 216 additions and 39 deletions

View file

@ -3,12 +3,11 @@ import BaseUIElement from "../BaseUIElement";
export class Button extends BaseUIElement {
private _text: BaseUIElement;
private _onclick: () => void;
constructor(text: string | BaseUIElement, onclick: (() => void)) {
constructor(text: string | BaseUIElement, onclick: (() => void | Promise<void>)) {
super();
this._text = Translations.W(text);
this._onclick = onclick;
this.onClick(onclick)
}
protected InnerConstructElement(): HTMLElement {
@ -20,7 +19,6 @@ export class Button extends BaseUIElement {
const button = document.createElement("button")
button.type = "button"
button.appendChild(el)
button.onclick = this._onclick
form.appendChild(button)
return form;
}