mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-20 15:56:35 +00:00
Weather Card: Show 5 element Forecast Longer (#5885)
This commit is contained in:
parent
d94df728e5
commit
ba384b9eee
@ -66,8 +66,8 @@ class HuiWeatherForecastCard extends LitElement implements LovelaceCard {
|
|||||||
|
|
||||||
@property() private _config?: WeatherForecastCardConfig;
|
@property() private _config?: WeatherForecastCardConfig;
|
||||||
|
|
||||||
@property({ type: Boolean, reflect: true, attribute: "narrow" })
|
@property({ type: Boolean, reflect: true, attribute: "veryverynarrow" })
|
||||||
private _narrow = false;
|
private _veryVeryNarrow = false;
|
||||||
|
|
||||||
private _resizeObserver?: ResizeObserver;
|
private _resizeObserver?: ResizeObserver;
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ class HuiWeatherForecastCard extends LitElement implements LovelaceCard {
|
|||||||
const forecast =
|
const forecast =
|
||||||
this._config?.show_forecast !== false &&
|
this._config?.show_forecast !== false &&
|
||||||
stateObj.attributes.forecast?.length
|
stateObj.attributes.forecast?.length
|
||||||
? stateObj.attributes.forecast.slice(0, this._narrow ? 3 : 5)
|
? stateObj.attributes.forecast.slice(0, this._veryVeryNarrow ? 3 : 5)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
let hourly: boolean | undefined;
|
let hourly: boolean | undefined;
|
||||||
@ -306,17 +306,17 @@ class HuiWeatherForecastCard extends LitElement implements LovelaceCard {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._narrow = this.offsetWidth < 375;
|
if (this.offsetWidth < 375) {
|
||||||
|
this.setAttribute("narrow", "");
|
||||||
|
} else {
|
||||||
|
this.removeAttribute("narrow");
|
||||||
|
}
|
||||||
if (this.offsetWidth < 300) {
|
if (this.offsetWidth < 300) {
|
||||||
this.setAttribute("verynarrow", "");
|
this.setAttribute("verynarrow", "");
|
||||||
} else {
|
} else {
|
||||||
this.removeAttribute("verynarrow");
|
this.removeAttribute("verynarrow");
|
||||||
}
|
}
|
||||||
if (this.offsetWidth < 225) {
|
this._veryVeryNarrow = this.offsetWidth < 245;
|
||||||
this.setAttribute("veryverynarrow", "");
|
|
||||||
} else {
|
|
||||||
this.removeAttribute("veryverynarrow");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static get styles(): CSSResult[] {
|
static get styles(): CSSResult[] {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user