+
+ {current && (
+ <>
+ {getIconUrl(current.weatherIconUrl) && (
+
+ )}
+
+ Temperature: {displayTemp(Number(current.temp_C))}°{unit}
+
+ Feels Like: {displayTemp(Number(current.FeelsLikeC))}°{unit}
+ Wind: {current.windspeedKmph} km/h
+ Humidity: {current.humidity}%
+ Desc: {current.weatherDesc?.[0]?.value}
+ >
+ )}
- {/* 3-Day Forecast */}
{forecast.map((day, i) => {
- const condition =
- day.hourly?.[0]?.weatherDesc?.[0]?.value || "Clear";
- const badge = getBadgeStyle(condition);
-
+ const badge = getBadgeStyle(day.hourly?.[0]?.weatherDesc?.[0]?.value);
return (
- {/* Badge Section */}
{badge.label}
-
-
- Avg Temp: {displayTemp(Number(day.avgtempC))}
- °{unit}
-
-
- Sunrise: {day.astronomy?.[0]?.sunrise}
-
-
- Sunset: {day.astronomy?.[0]?.sunset}
-
+ Avg Temp: {displayTemp(Number(day.avgtempC))}°{unit}
+ Sunrise: {day.astronomy?.[0]?.sunrise}
+ Sunset: {day.astronomy?.[0]?.sunset}
);
})}
)}
+
+ {loading && (
+