1
0
Fork 0

Add tsx syntax to NewSecretsEngine.

This commit is contained in:
Kitteh 2021-05-24 09:22:54 +01:00
parent 9648d6027f
commit d351e29220
2 changed files with 43 additions and 47 deletions

View file

@ -1,47 +0,0 @@
import { Page } from "../../types/Page";
import { Tile } from "../../elements/Tile";
import { makeElement } from "z-makeelement";
import i18next from "i18next";
export class NewSecretsEnginePage extends Page {
constructor() {
super();
}
async render(): Promise<void> {
await this.router.setPageContent(
makeElement({
tag: "div",
class: "uk-child-width-1-1@s uk-child-width-1-2@m uk-grid-small uk-grid-match",
attributes: { "uk-grid": "" },
children: [
Tile({
title: i18next.t("new_secrets_engine_kv_title"),
description: i18next.t("new_secrets_engine_kv_description"),
onclick: async () => {
await this.router.changePage("NEW_KV_ENGINE");
},
}),
Tile({
title: i18next.t("new_secrets_engine_totp_title"),
description: i18next.t("new_secrets_engine_totp_description"),
onclick: async () => {
await this.router.changePage("NEW_TOTP_ENGINE");
},
}),
Tile({
title: i18next.t("new_secrets_engine_transit_title"),
description: i18next.t("new_secrets_engine_transit_description"),
onclick: async () => {
await this.router.changePage("NEW_TRANSIT_ENGINE");
},
}),
],
}),
);
}
get name(): string {
return i18next.t("new_secrets_engine_title");
}
}

View file

@ -0,0 +1,43 @@
import { Page } from "../../types/Page";
import { Tile } from "../../elements/ReactTile";
import { render } from "preact";
import i18next from "i18next";
export class NewSecretsEnginePage extends Page {
constructor() {
super();
}
async render(): Promise<void> {
render(
<div class="uk-child-width-1-1@s uk-child-width-1-2@m uk-grid-small uk-grid-match" uk-grid>
<Tile
title={i18next.t("new_secrets_engine_kv_title")}
description={i18next.t("new_secrets_engine_kv_description")}
onclick={async () => {
await this.router.changePage("NEW_KV_ENGINE");
}}
/>
<Tile
title={i18next.t("new_secrets_engine_totp_title")}
description={i18next.t("new_secrets_engine_totp_description")}
onclick={async () => {
await this.router.changePage("NEW_TOTP_ENGINE");
}}
/>
<Tile
title={i18next.t("new_secrets_engine_transit_title")}
description={i18next.t("new_secrets_engine_transit_description")}
onclick={async () => {
await this.router.changePage("NEW_TRANSIT_ENGINE");
}}
/>
</div>,
this.router.pageContentElement,
);
}
get name(): string {
return i18next.t("new_secrets_engine_title");
}
}