Refactoring: use special rendering for mangrove key download in usersettings

This commit is contained in:
Pieter Vander Vennet 2023-09-21 02:31:35 +02:00
parent 3e46334767
commit a3c249474d
7 changed files with 49 additions and 10 deletions

View file

@ -1,18 +1,22 @@
import Translations from "../i18n/Translations"
import BaseUIElement from "../BaseUIElement"
import { Store } from "../../Logic/UIEventSource"
import { Utils } from "../../Utils"
export default class Link extends BaseUIElement {
private readonly _href: string | Store<string>
private readonly _embeddedShow: BaseUIElement
private readonly _newTab: boolean
private readonly _download: string
constructor(
embeddedShow: BaseUIElement | string,
href: string | Store<string>,
newTab: boolean = false
newTab: boolean = false,
download: string = undefined
) {
super()
this._download = download
this._embeddedShow = Translations.W(embeddedShow)
this._href = href
this._newTab = newTab
@ -58,6 +62,9 @@ export default class Link extends BaseUIElement {
if (this._newTab) {
el.target = "_blank"
}
if (this._download) {
el.download = this._download
}
el.appendChild(embeddedShow)
return el
}