add badge component
Signed-off-by: Tobias Erbshäußer <tobias@tesoft.dev>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<template id="tesoft-badge-template">
|
||||
<style>
|
||||
@import "/src/styles/default.css";
|
||||
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
|
||||
:host > div {
|
||||
background-color: var(--gold);
|
||||
border-radius: 0.4rem;
|
||||
color: var(--gray);
|
||||
font-weight: 600;
|
||||
padding: 0.2rem 0.5rem;
|
||||
}
|
||||
|
||||
slot {
|
||||
align-items: center;
|
||||
display: grid;
|
||||
gap: 0.5rem;
|
||||
grid-auto-flow: column;
|
||||
justify-content: start;
|
||||
}
|
||||
|
||||
::slotted(svg) {
|
||||
fill: var(--gray);
|
||||
}
|
||||
</style>
|
||||
|
||||
<div>
|
||||
<slot></slot>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script src="/src/components/badge.ts" type="module"></script>
|
||||
@@ -0,0 +1,15 @@
|
||||
import {TesoftComponent} from "../scripts/main.ts";
|
||||
|
||||
export class TesoftBadge extends TesoftComponent {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
const template = document.getElementById("tesoft-badge-template") as HTMLTemplateElement;
|
||||
const templateContent = template.content;
|
||||
|
||||
const shadowRoot = this.attachShadow({mode: "open"});
|
||||
shadowRoot.appendChild(templateContent.cloneNode(true));
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("tesoft-badge", TesoftBadge);
|
||||
Reference in New Issue
Block a user