diff --git a/src/panels/config/devices/device-detail/ha-device-entities-card.ts b/src/panels/config/devices/device-detail/ha-device-entities-card.ts index 3d869428ca..f54db76e0d 100644 --- a/src/panels/config/devices/device-detail/ha-device-entities-card.ts +++ b/src/panels/config/devices/device-detail/ha-device-entities-card.ts @@ -1,7 +1,8 @@ import "@material/mwc-list/mwc-list"; import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; -import { css, html, LitElement } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; +import { classMap } from "lit/directives/class-map"; import { until } from "lit/directives/until"; import { computeStateName } from "../../../../common/entity/compute_state_name"; import { stripPrefixFromEntityName } from "../../../../common/entity/strip_prefix_from_entity_name"; @@ -86,36 +87,42 @@ export class HaDeviceEntitiesCard extends LitElement { return html` -
- - ${shownEntities.map((entry) => - this.hass.states[entry.entity_id] - ? this._renderEntity(entry) - : this._renderEntry(entry) - )} - -
- ${hiddenEntities.length - ? !this.showHidden - ? html` - - ` - : html` + ${shownEntities.length + ? html` +
- ${hiddenEntities.map((entry) => this._renderEntry(entry))} - - - ` - : ""} + +
+ ` + : nothing} + ${hiddenEntities.length + ? html`
+ ${!this.showHidden + ? html` + + ` + : html` + + ${hiddenEntities.map((entry) => this._renderEntry(entry))} + + + `} +
` + : nothing}
${this.hass.localize( @@ -257,8 +264,8 @@ export class HaDeviceEntitiesCard extends LitElement { .disabled-entry { color: var(--secondary-text-color); } - #entities { - margin-top: -24px; /* match the spacing between card title and content of the device info card above it */ + .move-up { + margin-top: -24px; } #entities > * { margin: 8px 16px 8px 8px;