mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-03 22:47:47 +00:00
Restore hui-weather-forecast-card.ts
This commit is contained in:
parent
d99f8b0da8
commit
23462bacfa
@ -84,7 +84,7 @@ class HuiWeatherForecastCard extends LitElement implements LovelaceCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getCardSize(): number {
|
public getCardSize(): number {
|
||||||
return this._config?.show_forecast !== false ? 10 : 4;
|
return this._config?.show_forecast !== false ? 4 : 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public setConfig(config: WeatherForecastCardConfig): void {
|
public setConfig(config: WeatherForecastCardConfig): void {
|
||||||
@ -330,44 +330,38 @@ class HuiWeatherForecastCard extends LitElement implements LovelaceCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _measureCard() {
|
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) {
|
if (!this.isConnected) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (card.offsetWidth < 375) {
|
if (this.offsetWidth < 375) {
|
||||||
this.setAttribute("narrow", "");
|
this.setAttribute("narrow", "");
|
||||||
} else {
|
} else {
|
||||||
this.removeAttribute("narrow");
|
this.removeAttribute("narrow");
|
||||||
}
|
}
|
||||||
if (card.offsetWidth < 300) {
|
if (this.offsetWidth < 300) {
|
||||||
this.setAttribute("verynarrow", "");
|
this.setAttribute("verynarrow", "");
|
||||||
} else {
|
} else {
|
||||||
this.removeAttribute("verynarrow");
|
this.removeAttribute("verynarrow");
|
||||||
}
|
}
|
||||||
this._veryVeryNarrow = card.offsetWidth < 245;
|
this._veryVeryNarrow = this.offsetWidth < 245;
|
||||||
}
|
}
|
||||||
|
|
||||||
static get styles(): CSSResult[] {
|
static get styles(): CSSResult[] {
|
||||||
return [
|
return [
|
||||||
weatherSVGStyles,
|
weatherSVGStyles,
|
||||||
css`
|
css`
|
||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
ha-card {
|
ha-card {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
padding: 16px;
|
||||||
outline: none;
|
outline: none;
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
padding: 16px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: nowrap;
|
flex-wrap: nowrap;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user