From 37c4fa0168407cbf3c56810ce21eb611a376ac46 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Thu, 4 Jul 2024 15:53:56 +0200 Subject: [PATCH] Improve sensor card graph inside section grid --- src/panels/lovelace/cards/hui-entity-card.ts | 24 ++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/panels/lovelace/cards/hui-entity-card.ts b/src/panels/lovelace/cards/hui-entity-card.ts index 42861e70fe4e..3e06cf7bf197 100644 --- a/src/panels/lovelace/cards/hui-entity-card.ts +++ b/src/panels/lovelace/cards/hui-entity-card.ts @@ -8,6 +8,7 @@ import { PropertyValues, } from "lit"; import { customElement, property, state } from "lit/decorators"; +import { classMap } from "lit/directives/class-map"; import { ifDefined } from "lit/directives/if-defined"; import { styleMap } from "lit/directives/style-map"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; @@ -73,6 +74,8 @@ export class HuiEntityCard extends LitElement implements LovelaceCard { @property({ attribute: false }) public hass?: HomeAssistant; + @property() public layout?: string; + @state() private _config?: EntityCardConfig; private _footerElement?: HuiErrorCard | LovelaceHeaderFooter; @@ -132,8 +135,15 @@ export class HuiEntityCard extends LitElement implements LovelaceCard { const colored = stateObj && this.getStateColor(stateObj, this._config); + const fixedFooter = + this.layout === "grid" || this._footerElement !== undefined; + return html` - +
${name}
@@ -188,7 +198,7 @@ export class HuiEntityCard extends LitElement implements LovelaceCard { ` : ""}
- ${this._footerElement} + `; } @@ -309,6 +319,16 @@ export class HuiEntityCard extends LitElement implements LovelaceCard { font-size: 18px; color: var(--secondary-text-color); } + + .with-fixed-footer { + justify-content: flex-start; + } + .with-fixed-footer .footer { + position: absolute; + right: 0; + left: 0; + bottom: 0; + } `, ]; }