diff --git a/src/components/WeatherWidget.tsx b/src/components/WeatherWidget.tsx index c37ce9c..99f1fd2 100644 --- a/src/components/WeatherWidget.tsx +++ b/src/components/WeatherWidget.tsx @@ -2,6 +2,10 @@ import { useState, useEffect } from 'react'; +function celsiusToFahrenheit(c: number): number { + return Math.round((c * 9/5) + 32); +} + export default function WeatherWidget() { const [weather, setWeather] = useState(null); const [loading, setLoading] = useState(true); @@ -63,6 +67,9 @@ export default function WeatherWidget() { }; const icon = weatherIcons[current.weathercode] || '🌤️'; + const tempF = celsiusToFahrenheit(current.celsius); + const maxF = celsiusToFahrenheit(today.maxC); + const minF = celsiusToFahrenheit(today.minC); return (
{icon}
-
- {current.celsius}°C +
+ {current.celsius}°C / {tempF}°F
{current.summary} @@ -95,7 +102,7 @@ export default function WeatherWidget() { color: '#555' }}> 📍 Otavalo - ↑{today.maxC}° ↓{today.minC}° + ↑{today.maxC}°C ({maxF}°F) ↓{today.minC}°C ({minF}°F)
);