feat: enhance ChangeAPI and ChangePreferences components; add "API key update" functionality and save preferences feature

This commit is contained in:
2025-08-01 01:06:58 +02:00
parent 6f3d945213
commit 8341e50dc8
7 changed files with 250 additions and 41 deletions

View File

@@ -19,7 +19,25 @@ const WeatherData: React.FC = () => {
{weatherData?.name}
</h2>
<p className="text-5xl font-extrabold mb-2 text-blue-900">
{weatherData?.main?.temp} °C
{weatherData?.main?.temp}{" "}
{localStorage.getItem("unit") === "metric"
? "°C"
: localStorage.getItem("unit") === "imperial"
? "°F"
: "K"}
</p>
<p className="flex items-center justify-center gap-2">
{weatherData?.sys?.country && (
<>
<img
src={`https://flagcdn.com/${weatherData.sys.country.toLowerCase()}.svg`}
alt={weatherData.sys.country}
width={24}
height={18}
/>
<span>{weatherData.sys.country}</span>
</>
)}
</p>
<p className="text-lg mb-4 capitalize text-blue-600">
{weatherData?.weather?.[0]?.description}