2024-05-07 19:18:51 +00:00
|
|
|
import Image from "next/image";
|
2024-05-10 08:07:18 +00:00
|
|
|
|
2024-05-09 21:40:14 +00:00
|
|
|
import { useContext } from "react";
|
2024-05-10 08:07:18 +00:00
|
|
|
import { WeatherContext } from "./WeatherNow";
|
2024-05-17 20:55:48 +00:00
|
|
|
import { weatherIcons } from "@/app/weatherIcons";
|
2024-05-07 19:18:51 +00:00
|
|
|
|
2024-05-10 12:50:01 +00:00
|
|
|
export default function WeatherHero() {
|
2024-05-17 20:55:48 +00:00
|
|
|
const { weather } = useContext(WeatherContext);
|
|
|
|
const weatherCode = weather.current.weather_code;
|
|
|
|
const currentWeather = weatherIcons.filter((weather) => {
|
|
|
|
return weather.code === weatherCode;
|
|
|
|
});
|
|
|
|
return (
|
2024-05-10 08:07:18 +00:00
|
|
|
<>
|
2024-05-17 20:55:48 +00:00
|
|
|
<Image
|
|
|
|
className="h-44 w-auto mx-auto"
|
|
|
|
src={currentWeather[0].url}
|
|
|
|
alt="Weather icon"
|
|
|
|
/>
|
2024-05-10 08:07:18 +00:00
|
|
|
</>
|
2024-05-17 20:55:48 +00:00
|
|
|
);
|
|
|
|
}
|