Refactor weather

This commit is contained in:
Georgi Gardev
2023-11-19 13:00:42 +02:00
parent 33da176b10
commit c86a06c120

View File

@@ -15,25 +15,29 @@ export function Weather() {
return (
<div class={style.Weather}>
<Show when={weather()} fallback="Loading">
<div class={`${style.WeatherLine} ${style.Delimiter}`}>
<i class={`wi wi-owm-${weather()?.id} ${style.WeatherIcon}`}></i>
<div class={style.FeelsLike}>
<span>{weather()?.feels_like}&deg;</span>
<span>{weather()?.main}</span>
</div>
</div>
<div class={style.WeatherLine}>
<HiSolidArrowDown color="lightcoral" />
{weather()?.temp_min}&deg; <HiSolidArrowUp color="lightgreen" /> {weather()?.temp_max}
&deg;
<WiHumidity />
{weather()?.humidity}%<br />
</div>
<div class={style.WeatherLine}></div>
<div class={style.WeatherLine}>
<WiSunrise /> {sunrise()}
<WiSunset /> {sunset()}
</div>
{(weather) => (
<>
<div class={`${style.WeatherLine} ${style.Delimiter}`}>
<i class={`wi wi-owm-${weather().id} ${style.WeatherIcon}`}></i>
<div class={style.FeelsLike}>
<span>{weather().feels_like}&deg;</span>
<span>{weather().main}</span>
</div>
</div>
<div class={style.WeatherLine}>
<HiSolidArrowDown color="lightcoral" />
{weather().temp_min}&deg; <HiSolidArrowUp color="lightgreen" /> {weather().temp_max}
&deg;
<WiHumidity />
{weather().humidity}%<br />
</div>
<div class={style.WeatherLine}></div>
<div class={style.WeatherLine}>
<WiSunrise /> {sunrise()}
<WiSunset /> {sunset()}
</div>
</>
)}
</Show>
</div>
);