weathericon
This commit is contained in:
parent
b3c7724c12
commit
30518a0fba
@ -17,8 +17,7 @@ import { HourlyForecast } from "@/types/types";
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function getCurrentWeatherIcon(weather: HourlyForecast) {
|
function getCurrentWeatherIcon(weatherCode: number) {
|
||||||
const weatherCode = weather.current.weather_code;
|
|
||||||
switch (weatherCode) {
|
switch (weatherCode) {
|
||||||
default:
|
default:
|
||||||
return sun;
|
return sun;
|
||||||
@ -84,10 +83,11 @@ function getCurrentWeatherIcon(weather: HourlyForecast) {
|
|||||||
|
|
||||||
export default function WeatherIcon() {
|
export default function WeatherIcon() {
|
||||||
const { weather } = useContext(WeatherContext)
|
const { weather } = useContext(WeatherContext)
|
||||||
|
const weatherCode = weather.current.weather_code
|
||||||
return(
|
return(
|
||||||
<>
|
<>
|
||||||
<Image src={getCurrentWeatherIcon(weather)} alt="Weather icon"/>
|
<Image src={getCurrentWeatherIcon(weatherCode)} alt="Weather icon"/>
|
||||||
<p>{weather.current.weather_code}</p>
|
{console.log(weatherCode)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user