2021-06-10 01:36:20 +02:00
|
|
|
import BaseUIElement from "../BaseUIElement"
|
2021-06-12 02:58:32 +02:00
|
|
|
import { UIElement } from "../UIElement"
|
2023-06-14 20:39:36 +02:00
|
|
|
import Translations from "../i18n/Translations"
|
|
|
|
|
import Combine from "./Combine"
|
|
|
|
|
import Img from "./Img"
|
2020-07-29 16:46:45 +02:00
|
|
|
|
2023-05-22 01:37:02 +02:00
|
|
|
/**
|
|
|
|
|
* @deprecated
|
|
|
|
|
*/
|
2021-06-12 02:58:32 +02:00
|
|
|
export class SubtleButton extends UIElement {
|
2021-12-21 19:09:24 +01:00
|
|
|
private readonly imageUrl: string | BaseUIElement
|
|
|
|
|
private readonly message: string | BaseUIElement
|
2021-05-30 00:17:31 +02:00
|
|
|
|
2022-04-24 01:32:19 +02:00
|
|
|
constructor(
|
|
|
|
|
imageUrl: string | BaseUIElement,
|
2025-06-18 22:31:50 +02:00
|
|
|
message: string | BaseUIElement
|
2022-04-24 01:32:19 +02:00
|
|
|
) {
|
2021-06-12 02:58:32 +02:00
|
|
|
super()
|
2021-12-21 19:09:24 +01:00
|
|
|
this.imageUrl = imageUrl
|
|
|
|
|
this.message = message
|
2021-05-30 00:17:31 +02:00
|
|
|
}
|
|
|
|
|
|
2021-12-21 19:09:24 +01:00
|
|
|
protected InnerRender(): string | BaseUIElement {
|
2023-06-14 20:39:36 +02:00
|
|
|
const classes = "button"
|
|
|
|
|
const message = Translations.W(this.message)?.SetClass(
|
|
|
|
|
"block overflow-ellipsis no-images flex-shrink"
|
|
|
|
|
)
|
|
|
|
|
let img
|
|
|
|
|
const imgClasses =
|
2025-06-18 22:31:50 +02:00
|
|
|
"block justify-center flex-none mr-4 h-11 w-11"
|
2023-05-11 02:17:41 +02:00
|
|
|
if ((this.imageUrl ?? "") === "") {
|
2023-06-14 20:39:36 +02:00
|
|
|
img = undefined
|
|
|
|
|
} else if (typeof this.imageUrl === "string") {
|
2023-05-11 02:17:41 +02:00
|
|
|
img = new Img(this.imageUrl)?.SetClass(imgClasses)
|
|
|
|
|
} else {
|
2023-06-14 20:39:36 +02:00
|
|
|
img = this.imageUrl?.SetClass(imgClasses)
|
2023-05-11 02:17:41 +02:00
|
|
|
}
|
2023-06-14 20:39:36 +02:00
|
|
|
const button = new Combine([img, message]).SetClass("flex items-center group w-full")
|
2023-05-11 02:17:41 +02:00
|
|
|
|
|
|
|
|
this.SetClass(classes)
|
|
|
|
|
return button
|
2020-07-29 16:46:45 +02:00
|
|
|
}
|
|
|
|
|
}
|