web/elements: add spinner when loading dynamic routes

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2022-06-18 13:36:18 +02:00
parent 7caac1d0c7
commit cdf88e4477
3 changed files with 11 additions and 7 deletions

View File

@ -1,6 +1,8 @@
import { TemplateResult, html } from "lit";
import { until } from "lit/directives/until.js";
import "../EmptyState";
export const SLUG_REGEX = "[-a-zA-Z0-9_]+";
export const ID_REGEX = "\\d+";
export const UUID_REGEX = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
@ -47,7 +49,10 @@ export class Route {
render(args: RouteArgs): TemplateResult {
if (this.callback) {
return html`${until(this.callback(args))}`;
return html`${until(
this.callback(args),
html`<ak-empty-state ?loading=${true}></ak-empty-state>`,
)}`;
}
if (this.element) {
return this.element;