import { LitElement, html, css, nothing } from 'lit'; import { property, customElement } from 'lit/decorators.js'; @customElement('emerald-counter') export class EmeraldCounter extends LitElement { static styles = css` :host { display: inline-block; aspect-ratio: 1 / 1; } div#main { position: relative; display: block; width: 100%; height: 100%; } svg { position: relative; display: block; width: 100%; height: 100%; z-index: 0; } div#counter { display: grid; justify-content: center; align-content: center; position: absolute; z-index: 1; font-family: "Helvetica Neue", "Arial Nova", Helvetica, Arial, sans-serif; font-size: 0.25em; top: 8%; left: 60%; width: 30%; height: 30%; aspect-ratio: 1 / 1; border-radius: 50%; border: 0.2em solid white; font-weight: bold; background: red; color: white; } div#counter span { padding-top: 0.28em; vertical-align: text-bottom; } `; @property({ type: Number, attribute: "current-count" }) counter = 0; @property({ attribute: "icon-color" }) color = "#000000"; render() { return html`
${!this.counter || this.counter < 1 ? nothing : html`
${this.counter}
`}
`; } }