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

View file

@ -6,15 +6,6 @@ import i18next from 'i18next';
import { getTransitKey } from "../../api/transit/getTransitKey"; import { getTransitKey } from "../../api/transit/getTransitKey";
import { Tile } from "../../elements/Tile"; import { Tile } from "../../elements/Tile";
type TileParams = {
condition: Boolean;
title: string;
description: string;
icon: string;
iconText: string;
onclick: () => void;
}
export class TransitViewSecretPage extends Page { export class TransitViewSecretPage extends Page {
constructor() { constructor() {
super(); super();
@ -31,11 +22,8 @@ export class TransitViewSecretPage extends Page {
setPageContent(makeElement({ setPageContent(makeElement({
tag: "div", 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": "" }, attributes: { "uk-grid": "" },
children: [
makeElement({
tag: "div",
children: [ children: [
Tile({ Tile({
condition: transitKey.supports_encryption, condition: transitKey.supports_encryption,
@ -54,8 +42,6 @@ export class TransitViewSecretPage extends Page {
onclick: () => { changePage("TRANSIT_DECRYPT"); } onclick: () => { changePage("TRANSIT_DECRYPT"); }
}), }),
] ]
}),
]
})); }));
} }