2024-05-07 19:18:51 +00:00
|
|
|
import Image from "next/image";
|
2024-05-17 20:55:48 +00:00
|
|
|
import { weatherIcons } from "@/app/weatherIcons";
|
2024-05-10 08:07:18 +00:00
|
|
|
|
2024-05-10 12:50:01 +00:00
|
|
|
// this component takes WeatherIconPropType as props and shows the weather icon for the hour index it is given in timeIndex prop.
|
2024-05-17 20:55:48 +00:00
|
|
|
export default function WeatherIcon(props: { weatherCode: number }) {
|
|
|
|
const currentWeather = weatherIcons.filter((weather) => {
|
|
|
|
return weather.code === props.weatherCode;
|
|
|
|
});
|
|
|
|
return (
|
2024-05-12 19:14:36 +00:00
|
|
|
<div className="h-12">
|
2024-05-17 20:55:48 +00:00
|
|
|
<Image
|
|
|
|
className="mt-2 max-h-12 mx-auto w-auto"
|
|
|
|
src={currentWeather[0].url}
|
|
|
|
alt="Weather icon"
|
|
|
|
width={100}
|
|
|
|
height={100}
|
|
|
|
/>
|
2024-05-10 17:23:02 +00:00
|
|
|
</div>
|
2024-05-17 20:55:48 +00:00
|
|
|
);
|
|
|
|
}
|