1
0
Fork 0

Make TransitViewSecret page look prettyer.

This commit is contained in:
Kitteh 2021-05-09 14:48:47 +01:00
parent ba3df3af78
commit c1ce81ba0d
2 changed files with 20 additions and 35 deletions

View file

@ -6,11 +6,10 @@ type optionsFunctionsObject = {
const optionsFunctions: optionsFunctionsObject = {
"class": (e: Element, arg: string | string[]) => {
if (Array.isArray(arg)) {
e.classList.add(...arg);
} else {
e.classList.add(arg);
if (!Array.isArray(arg)) {
arg = String(arg).split(" ");
}
e.classList.add(...arg);
},
"id": (e: Element, arg: string) => e.id = arg,
"html": (e: Element, arg: string) => e.innerHTML = arg,
@ -57,7 +56,7 @@ export function makeElement(elementInfo: ElementInfo): HTMLElement {
return element;
}
export function setElementAttributes(element: Element, attributes: {[propName: string]: any}): void {
export function setElementAttributes(element: Element, attributes: { [propName: string]: any }): void {
for (const key of Object.getOwnPropertyNames(attributes)) {
element.setAttribute(key, attributes[key]);
}

View file

@ -6,15 +6,6 @@ import i18next from 'i18next';
import { getTransitKey } from "../../api/transit/getTransitKey";
import { Tile } from "../../elements/Tile";
type TileParams = {
condition: Boolean;
title: string;
description: string;
icon: string;
iconText: string;
onclick: () => void;
}
export class TransitViewSecretPage extends Page {
constructor() {
super();
@ -31,29 +22,24 @@ export class TransitViewSecretPage extends Page {
setPageContent(makeElement({
tag: "div",
class: ["uk-list", "uk-width-1-1@s"],
class: "uk-child-width-1-1@s uk-child-width-1-2@m uk-grid-small uk-grid-match",
attributes: { "uk-grid": "" },
children: [
makeElement({
tag: "div",
children: [
Tile({
condition: transitKey.supports_encryption,
title: i18next.t("transit_view_encrypt_text"),
description: i18next.t("transit_view_encrypt_description"),
icon: "lock",
iconText: i18next.t("transit_view_encrypt_icon_text"),
onclick: () => { changePage("TRANSIT_ENCRYPT"); }
}),
Tile({
condition: transitKey.supports_decryption,
title: i18next.t("transit_view_decrypt_text"),
description: i18next.t("transit_view_decrypt_description"),
icon: "mail",
iconText: i18next.t("transit_view_decrypt_icon_text"),
onclick: () => { changePage("TRANSIT_DECRYPT"); }
}),
]
Tile({
condition: transitKey.supports_encryption,
title: i18next.t("transit_view_encrypt_text"),
description: i18next.t("transit_view_encrypt_description"),
icon: "lock",
iconText: i18next.t("transit_view_encrypt_icon_text"),
onclick: () => { changePage("TRANSIT_ENCRYPT"); }
}),
Tile({
condition: transitKey.supports_decryption,
title: i18next.t("transit_view_decrypt_text"),
description: i18next.t("transit_view_decrypt_description"),
icon: "mail",
iconText: i18next.t("transit_view_decrypt_icon_text"),
onclick: () => { changePage("TRANSIT_DECRYPT"); }
}),
]
}));