Restore theme usage in stack card in panel view (#20264)

This commit is contained in:
Paul Bottein 2024-03-29 11:16:28 +01:00 committed by GitHub
parent 5dd029cc05
commit d1119a3b61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 5 deletions

View File

@ -98,10 +98,10 @@ export abstract class HuiStackCard<T extends StackCardConfig = StackCardConfig>
display: block;
padding: 24px 16px 16px;
}
:host {
--ha-card-border-radius: inherit !important;
--ha-card-border-width: inherit !important;
--ha-card-box-shadow: inherit !important;
#root {
--ha-card-border-radius: var(--restore-card-border-radius, inherit);
--ha-card-border-width: var(--restore-card-border-width, inherit);
--ha-card-box-shadow: var(--restore-card-border-shadow, inherit);
}
`;
}

View File

@ -108,6 +108,7 @@ export class PanelView extends LitElement implements LovelaceViewElement {
const card: LovelaceCard = this.cards[0];
card.isPanel = true;
card.toggleAttribute("no-border", true);
if (this.isStrategy || !this.lovelace?.editMode) {
card.editMode = false;
@ -116,6 +117,7 @@ export class PanelView extends LitElement implements LovelaceViewElement {
}
const wrapper = document.createElement("hui-card-options");
wrapper.toggleAttribute("no-border", true);
wrapper.hass = this.hass;
wrapper.lovelace = this.lovelace;
wrapper.path = [this.index!, 0];
@ -130,9 +132,12 @@ export class PanelView extends LitElement implements LovelaceViewElement {
:host {
display: block;
height: 100%;
--restore-card-border-radius: var(--ha-card-border-radius, 12px);
--restore-card-border-width: var(--ha-card-border-width, 1px);
--restore-card-box-shadow: var(--ha-card-box-shadow, none);
}
* {
[no-border] {
--ha-card-border-radius: 0;
--ha-card-border-width: 0;
--ha-card-box-shadow: none;