Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix visibility for shown entities on device card #22579

Merged
32 changes: 22 additions & 10 deletions src/panels/config/devices/device-detail/ha-device-entities-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
LitElement,
PropertyValues,
TemplateResult,
nothing
} from "lit";
import { customElement, property, state } from "lit/decorators";
import { until } from "lit/directives/until";
Expand Down Expand Up @@ -92,15 +93,19 @@ export class HaDeviceEntitiesCard extends LitElement {

return html`
<ha-card outlined .header=${this.header}>
<div id="entities">
<mwc-list>
${shownEntities.map((entry) =>
this.hass.states[entry.entity_id]
? this._renderEntity(entry)
: this._renderEntry(entry)
)}
</mwc-list>
</div>
${shownEntities.length
? html`
<div id="entities">
ildar170975 marked this conversation as resolved.
Show resolved Hide resolved
<mwc-list>
${shownEntities.map((entry) =>
this.hass.states[entry.entity_id]
? this._renderEntity(entry)
: this._renderEntry(entry)
)}
</mwc-list>
</div>
`
: nothing}
${hiddenEntities.length
? !this.showHidden
? html`
Expand All @@ -121,7 +126,7 @@ export class HaDeviceEntitiesCard extends LitElement {
)}
</button>
`
: ""}
: nothing}
<div class="card-actions">
<mwc-button @click=${this._addToLovelaceView}>
${this.hass.localize(
Expand Down Expand Up @@ -303,6 +308,13 @@ export class HaDeviceEntitiesCard extends LitElement {
outline: none;
text-decoration: underline;
}
mwc-list:has(.disabled-entry) {
--mdc-list-vertical-padding: 0;
margin-top: -8px;
}
#entities + mwc-list:has(.disabled-entry) {
margin-top: 8px;
}
ildar170975 marked this conversation as resolved.
Show resolved Hide resolved
ha-list-item {
height: 40px;
}
Expand Down
Loading