2020-07-29 16:46:45 +02:00
|
|
|
import {UIElement} from "../UIElement";
|
|
|
|
import Translations from "../i18n/Translations";
|
|
|
|
import Combine from "./Combine";
|
2020-07-29 19:02:36 +02:00
|
|
|
import {link} from "fs";
|
2020-07-29 16:46:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
export class SubtleButton extends UIElement{
|
|
|
|
private imageUrl: string;
|
|
|
|
private message: UIElement;
|
2020-07-29 19:02:36 +02:00
|
|
|
private linkTo: string = undefined;
|
2020-07-29 16:46:45 +02:00
|
|
|
|
2020-07-29 19:02:36 +02:00
|
|
|
constructor(imageUrl: string, message: string | UIElement, linkTo : string = undefined) {
|
2020-07-29 16:46:45 +02:00
|
|
|
super(undefined);
|
2020-07-29 19:02:36 +02:00
|
|
|
this.linkTo = linkTo;
|
2020-07-29 16:46:45 +02:00
|
|
|
this.message = Translations.W(message);
|
|
|
|
this.imageUrl = imageUrl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
InnerRender(): string {
|
2020-07-29 19:02:36 +02:00
|
|
|
|
|
|
|
if(this.linkTo != undefined){
|
|
|
|
return new Combine([
|
|
|
|
`<a class="subtle-button" href="${this.linkTo}" target="_blank">`,
|
|
|
|
this.imageUrl !== undefined ? `<img src='${this.imageUrl}'>` : "",
|
|
|
|
this.message,
|
|
|
|
'</a>'
|
|
|
|
]).Render();
|
|
|
|
}
|
|
|
|
|
2020-07-29 16:46:45 +02:00
|
|
|
return new Combine([
|
|
|
|
'<span class="subtle-button">',
|
2020-07-29 18:35:46 +02:00
|
|
|
this.imageUrl !== undefined ? `<img src='${this.imageUrl}'>` : "",
|
2020-07-29 16:46:45 +02:00
|
|
|
this.message,
|
|
|
|
'</span>'
|
|
|
|
]).Render();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|