From 23462bacfa7d3df9f799ce12ea086af843eb1c47 Mon Sep 17 00:00:00 2001 From: Zack Barett Date: Tue, 3 Nov 2020 23:00:02 -0600 Subject: [PATCH] Restore hui-weather-forecast-card.ts --- .../cards/hui-weather-forecast-card.ts | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/panels/lovelace/cards/hui-weather-forecast-card.ts b/src/panels/lovelace/cards/hui-weather-forecast-card.ts index c93799d4a1..98726230bc 100644 --- a/src/panels/lovelace/cards/hui-weather-forecast-card.ts +++ b/src/panels/lovelace/cards/hui-weather-forecast-card.ts @@ -84,7 +84,7 @@ class HuiWeatherForecastCard extends LitElement implements LovelaceCard { } public getCardSize(): number { - return this._config?.show_forecast !== false ? 10 : 4; + return this._config?.show_forecast !== false ? 4 : 2; } public setConfig(config: WeatherForecastCardConfig): void { @@ -330,44 +330,38 @@ class HuiWeatherForecastCard extends LitElement implements LovelaceCard { } private _measureCard() { - const card = this.shadowRoot!.querySelector("ha-card"); - // If we show an error or warning there is no ha-card - if (!card) { - return; - } - if (!this.isConnected) { return; } - if (card.offsetWidth < 375) { + if (this.offsetWidth < 375) { this.setAttribute("narrow", ""); } else { this.removeAttribute("narrow"); } - if (card.offsetWidth < 300) { + if (this.offsetWidth < 300) { this.setAttribute("verynarrow", ""); } else { this.removeAttribute("verynarrow"); } - this._veryVeryNarrow = card.offsetWidth < 245; + this._veryVeryNarrow = this.offsetWidth < 245; } static get styles(): CSSResult[] { return [ weatherSVGStyles, css` + :host { + display: block; + } + ha-card { cursor: pointer; + padding: 16px; outline: none; - height: 100%; - display: flex; - flex-direction: column; - justify-content: center; } .content { - padding: 16px; display: flex; flex-wrap: nowrap; justify-content: space-between;