add loader section component

Signed-off-by: Tobias Erbshäußer <tobias@tesoft.dev>
This commit is contained in:
2026-05-24 09:22:43 +02:00
parent 1b0415d767
commit b8cf32813d
2 changed files with 60 additions and 0 deletions
@@ -0,0 +1,37 @@
<template id="tesoft-loader-section-template">
<style>
@import "/src/styles/default.css";
:host {
display: grid;
}
:host > div {
align-items: center;
display: grid;
grid-template-columns: 1fr;
grid-template-rows: 1fr;
justify-items: center;
}
:host([loaded]) > div {
align-self: start;
}
:host(:not([loaded])) slot {
display: none;
}
:host([loaded]) tesoft-loader {
display: none;
}
</style>
<div>
<tesoft-loader></tesoft-loader>
<slot></slot>
</div>
</template>
<script src="/src/components/loader-section.ts" type="module"></script>
{% includeOnce 'components/loader.njk' %}
+23
View File
@@ -0,0 +1,23 @@
import {TesoftComponent} from "../scripts/main.ts";
export class TesoftLoaderSection extends TesoftComponent {
constructor() {
super();
const template = document.getElementById("tesoft-loader-section-template") as HTMLTemplateElement;
const templateContent = template.content;
const shadowRoot = this.attachShadow({mode: "open"});
shadowRoot.appendChild(templateContent.cloneNode(true));
}
reset() {
this.removeAttribute("loaded");
}
finish() {
this.setAttribute("loaded", "");
}
}
customElements.define("tesoft-loader-section", TesoftLoaderSection);