Refactor ha-config-labels to use `styleMap` (#27248)

pull/27251/head
Jan-Philipp Benecke 2025-09-29 21:05:17 +02:00 committed by GitHub
parent c998086474
commit 60e07075bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 7 deletions

View File

@ -10,6 +10,7 @@ import type { PropertyValues } from "lit";
import { LitElement, html, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import memoizeOne from "memoize-one";
import { styleMap } from "lit/directives/style-map";
import { computeCssColor } from "../../../common/color/compute-color";
import { formatShortDateTime } from "../../../common/datetime/format_date_time";
import { storage } from "../../../common/decorators/storage";
@ -104,13 +105,14 @@ export class HaConfigLabels extends LitElement {
template: (label) =>
label.color
? html`<div
style="
background-color: ${computeCssColor(label.color)};
border-radius: 10px;
border: 1px solid var(--outline-color);
box-sizing: border-box;
width: 20px;
height: 20px;"
style=${styleMap({
backgroundColor: computeCssColor(label.color),
borderRadius: "10px",
border: "1px solid var(--outline-color)",
boxSizing: "border-box",
width: "20px",
height: "20px",
})}
></div>`
: nothing,
},