From 0a0481d63f45948654fd740d465395c747bffac4 Mon Sep 17 00:00:00 2001 From: ChrQR Date: Fri, 10 May 2024 12:34:38 +0200 Subject: [PATCH] fixed weather code context --- app/page.tsx | 1 - components/Temperature.tsx | 3 +-- components/WeatherIcon.tsx | 6 ++---- components/WeatherNow.tsx | 2 ++ 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index d7acd02..0b541b0 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -26,7 +26,6 @@ export default function Home() {
-
diff --git a/components/Temperature.tsx b/components/Temperature.tsx index bdc01ef..ff12b70 100644 --- a/components/Temperature.tsx +++ b/components/Temperature.tsx @@ -9,5 +9,4 @@ export default function Temperature() { return (

{feels}°C

) -} - +} \ No newline at end of file diff --git a/components/WeatherIcon.tsx b/components/WeatherIcon.tsx index 410f5c8..efd0fa3 100644 --- a/components/WeatherIcon.tsx +++ b/components/WeatherIcon.tsx @@ -13,7 +13,6 @@ import sun from '../public/sun.svg' import { useContext } from "react"; import { WeatherContext } from "./WeatherNow"; -import { HourlyForecast } from "@/types/types"; @@ -83,11 +82,10 @@ function getCurrentWeatherIcon(weatherCode: number) { export default function WeatherIcon() { const { weather } = useContext(WeatherContext) - const weatherCode = weather.current.weather_code return( <> - Weather icon - {console.log(weatherCode)} + Weather icon + {JSON.stringify(weather.current.weather_code)} ) }; \ No newline at end of file diff --git a/components/WeatherNow.tsx b/components/WeatherNow.tsx index 440f595..c6eab4a 100644 --- a/components/WeatherNow.tsx +++ b/components/WeatherNow.tsx @@ -6,6 +6,7 @@ import { HourlyForecast, WeatherContextType} from "@/types/types"; import { createContext, useContext, useEffect, useState } from "react"; import { defaultHourlyForecast } from "@/app/defaultState"; import { LocationContext } from "@/app/page"; +import WeatherIcon from "./WeatherIcon"; export const WeatherContext = createContext({ weather: defaultHourlyForecast, @@ -35,6 +36,7 @@ export default function WeatherNow() { <>

Here is the current weather in {geoLocation.name}

+