mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-02 22:17:48 +00:00
Title to Name (#2127)
This commit is contained in:
parent
d2741af24b
commit
bf69c8ce46
@ -10,16 +10,17 @@ import { LovelaceCard } from "../types";
|
|||||||
import { LovelaceCardConfig } from "../../../data/lovelace";
|
import { LovelaceCardConfig } from "../../../data/lovelace";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
import { fireEvent } from "../../../common/dom/fire_event";
|
import { fireEvent } from "../../../common/dom/fire_event";
|
||||||
|
import { hasConfigOrEntityChanged } from "../common/has-changed";
|
||||||
|
|
||||||
import isValidEntityId from "../../../common/entity/valid_entity_id";
|
import isValidEntityId from "../../../common/entity/valid_entity_id";
|
||||||
import applyThemesOnElement from "../../../common/dom/apply_themes_on_element";
|
import applyThemesOnElement from "../../../common/dom/apply_themes_on_element";
|
||||||
import { hasConfigOrEntityChanged } from "../common/has-changed";
|
import computeStateName from "../../../common/entity/compute_state_name";
|
||||||
|
|
||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
|
|
||||||
interface Config extends LovelaceCardConfig {
|
interface Config extends LovelaceCardConfig {
|
||||||
entity: string;
|
entity: string;
|
||||||
title?: string;
|
name?: string;
|
||||||
unit_of_measurement?: string;
|
unit_of_measurement?: string;
|
||||||
min?: number;
|
min?: number;
|
||||||
max?: number;
|
max?: number;
|
||||||
@ -93,7 +94,9 @@ class HuiGaugeCard extends LitElement implements LovelaceCard {
|
|||||||
""
|
""
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div id="title">${this._config.title}</div>
|
<div id="name">
|
||||||
|
${this._config.name || computeStateName(stateObj)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
@ -211,7 +214,7 @@ class HuiGaugeCard extends LitElement implements LovelaceCard {
|
|||||||
.gauge-data #percent {
|
.gauge-data #percent {
|
||||||
font-size: calc(var(--base-unit) * 0.55);
|
font-size: calc(var(--base-unit) * 0.55);
|
||||||
}
|
}
|
||||||
.gauge-data #title {
|
.gauge-data #name {
|
||||||
padding-top: calc(var(--base-unit) * 0.15);
|
padding-top: calc(var(--base-unit) * 0.15);
|
||||||
font-size: calc(var(--base-unit) * 0.3);
|
font-size: calc(var(--base-unit) * 0.3);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user