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

33
frontend/src/ui/image.ts Normal file
View File

@@ -0,0 +1,33 @@
import { UINode } from "./node";
export class Image extends UINode {
private imgElement: HTMLImageElement;
public constructor(title: string, src: string, altText: string = "") {
super(title);
this.imgElement = document.createElement("img");
this.imgElement.src = src;
this.imgElement.alt = altText;
this.element.appendChild(this.imgElement);
this.element.setAttribute("aria-label", title);
}
public getElement(): HTMLElement {
return this.imgElement;
}
public setText(text: string) {
this.title = text;
this.element.setAttribute("aria-label", text);
return this;
}
public setSource(src: string) {
this.imgElement.src = src;
return this;
}
public setAltText(altText: string) {
this.imgElement.alt = altText;
return this;
}
}