Initial move

This commit is contained in:
2024-09-03 14:50:33 +02:00
parent adb6be0006
commit 9fa656ed5e
138 changed files with 13117 additions and 0 deletions

39
frontend/src/ui/button.ts Normal file
View File

@@ -0,0 +1,39 @@
import { UINode } from "./node";
export class Button extends UINode {
private buttonElement: HTMLButtonElement;
public constructor(title: string, hasPopup: boolean = false) {
super(title);
this.buttonElement = document.createElement("button");
this.buttonElement.innerText = title;
if (hasPopup) this.buttonElement.setAttribute("aria-haspopup", "true");
this.element.appendChild(this.buttonElement);
this.element.setAttribute("aria-label", this.title);
}
public focus() {
this.buttonElement.focus();
return this;
}
public click() {
this.buttonElement.click();
return this;
}
public getElement(): HTMLElement {
return this.buttonElement;
}
public setText(text: string) {
this.title = text;
this.buttonElement.innerText = text;
this.element.setAttribute("aria-label", this.title);
return this;
}
public setDisabled(val: boolean) {
this.buttonElement.disabled = val;
return this;
}
}