1
0
mirror of https://github.com/home-assistant/frontend.git synced 2026-04-17 15:45:43 +01:00
Files
frontend/src/state-summary/state-card-timer.ts
2024-12-06 18:39:34 +01:00

59 lines
1.6 KiB
TypeScript

import type { HassEntity } from "home-assistant-js-websocket";
import type { CSSResultGroup, TemplateResult } from "lit";
import { css, html, LitElement } from "lit";
import { customElement, property } from "lit/decorators";
import "../components/entity/state-info";
import { haStyle } from "../resources/styles";
import "../state-display/ha-timer-remaining-time";
import type { HomeAssistant } from "../types";
@customElement("state-card-timer")
class StateCardTimer extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property({ attribute: false }) public stateObj!: HassEntity;
@property({ attribute: "in-dialog", type: Boolean }) public inDialog = false;
protected render(): TemplateResult {
return html`
<div class="horizontal justified layout">
<state-info
.hass=${this.hass}
.stateObj=${this.stateObj}
.inDialog=${this.inDialog}
></state-info>
<div class="state">
<ha-timer-remaining-time
.hass=${this.hass}
.stateObj=${this.stateObj}
></ha-timer-remaining-time>
</div>
</div>
`;
}
static get styles(): CSSResultGroup {
return [
haStyle,
css`
.state {
color: var(--primary-text-color);
margin-left: 16px;
margin-inline-start: 16px;
margin-inline-end: initial;
text-align: var(--float-end);
line-height: 40px;
white-space: nowrap;
}
`,
];
}
}
declare global {
interface HTMLElementTagNameMap {
"state-card-timer": StateCardTimer;
}
}