web/elements: add PageHeader element to replace page

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2021-04-10 17:06:54 +02:00
parent 1fbf6be6c2
commit 6f7fb4c919
23 changed files with 456 additions and 561 deletions

View File

@ -5,8 +5,7 @@ import { RouteMatch } from "./RouteMatch";
import AKGlobal from "../../authentik.css";
import "./Router404";
import { Page } from "../Page";
import { ROUTE_SEPARATOR, TITLE_SUFFIX } from "../../constants";
import { ROUTE_SEPARATOR } from "../../constants";
// Poliyfill for hashchange.newURL,
// https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onhashchange
@ -38,8 +37,6 @@ export class RouterOutlet extends LitElement {
}
*:first-child {
height: 100%;
display: flex;
flex-direction: column;
}
`,
];
@ -54,18 +51,6 @@ export class RouterOutlet extends LitElement {
this.navigate();
}
updated(): void {
if (!this.shadowRoot) return;
Array.from(this.shadowRoot?.children).forEach((el) => {
if ("pageTitle" in el) {
const title = (el as Page).pageTitle();
document.title = `${title} - ${TITLE_SUFFIX}`;
} else {
document.title = TITLE_SUFFIX;
}
});
}
navigate(ev?: HashChangeEvent): void {
let activeUrl = window.location.hash.slice(1, Infinity).split(ROUTE_SEPARATOR)[0];
if (ev) {