mirror of
https://github.com/hazemKrimi/react-weather-app.git
synced 2026-05-01 18:30:25 +00:00
Update temp conditions
This commit is contained in:
+3
-3
@@ -130,7 +130,6 @@ const Home: React.FC = () => {
|
|||||||
setLoading(false);
|
setLoading(false);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
console.error(err);
|
|
||||||
setError('Could not get weather data! Try again later');
|
setError('Could not get weather data! Try again later');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -158,7 +157,7 @@ const Home: React.FC = () => {
|
|||||||
date={new Date(weather.timestamp * 1000)}
|
date={new Date(weather.timestamp * 1000)}
|
||||||
time={false}
|
time={false}
|
||||||
data={weather.main.temp + '°C'}
|
data={weather.main.temp + '°C'}
|
||||||
temp={weather.main.temp > 35 ? 'hot' : weather.main.temp < 20 ? 'cold' : null}
|
temp={weather.main.temp > 25 ? 'hot' : weather.main.temp < 20 ? 'cold' : null}
|
||||||
icon={weather.icon}
|
icon={weather.icon}
|
||||||
description={weather.description}
|
description={weather.description}
|
||||||
/>
|
/>
|
||||||
@@ -173,6 +172,7 @@ const Home: React.FC = () => {
|
|||||||
date={new Date(day.dt * 1000)}
|
date={new Date(day.dt * 1000)}
|
||||||
time={false}
|
time={false}
|
||||||
data={day.temp.min + '°C/' + day.temp.max + '°C'}
|
data={day.temp.min + '°C/' + day.temp.max + '°C'}
|
||||||
|
temp={day.temp.max > 25 ? 'hot' : day.temp.max < 20 ? 'cold' : null}
|
||||||
icon={day.weather[0].id}
|
icon={day.weather[0].id}
|
||||||
description={day.weather[0].description}
|
description={day.weather[0].description}
|
||||||
/>
|
/>
|
||||||
@@ -190,7 +190,7 @@ const Home: React.FC = () => {
|
|||||||
date={new Date(hour.dt * 1000)}
|
date={new Date(hour.dt * 1000)}
|
||||||
time={true}
|
time={true}
|
||||||
data={hour.temp + '°C'}
|
data={hour.temp + '°C'}
|
||||||
temp={hour.temp > 35 ? 'hot' : hour.temp < 20 ? 'cold' : null}
|
temp={hour.temp > 25 ? 'hot' : hour.temp < 20 ? 'cold' : null}
|
||||||
icon={hour.weather[0].id}
|
icon={hour.weather[0].id}
|
||||||
description={hour.weather[0].description}
|
description={hour.weather[0].description}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -129,8 +129,7 @@ const Search: React.FC = () => {
|
|||||||
setLoading(false);
|
setLoading(false);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
console.error(err);
|
setError('Could not find any weather data! Try again later');
|
||||||
setError('No weather data found! Try again later');
|
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
@@ -151,6 +150,7 @@ const Search: React.FC = () => {
|
|||||||
date={new Date(weather.timestamp * 1000)}
|
date={new Date(weather.timestamp * 1000)}
|
||||||
time={false}
|
time={false}
|
||||||
data={weather.main.temp + '°C'}
|
data={weather.main.temp + '°C'}
|
||||||
|
temp={weather.main.temp > 25 ? 'hot' : weather.main.temp < 20 ? 'cold' : null}
|
||||||
icon={weather.icon}
|
icon={weather.icon}
|
||||||
description={weather.description}
|
description={weather.description}
|
||||||
/>
|
/>
|
||||||
@@ -165,6 +165,7 @@ const Search: React.FC = () => {
|
|||||||
date={new Date(day.dt * 1000)}
|
date={new Date(day.dt * 1000)}
|
||||||
time={false}
|
time={false}
|
||||||
data={day.temp.min + '°C/' + day.temp.max + '°C'}
|
data={day.temp.min + '°C/' + day.temp.max + '°C'}
|
||||||
|
temp={day.temp.max > 25 ? 'hot' : day.temp.max < 20 ? 'cold' : null}
|
||||||
icon={day.weather[0].id}
|
icon={day.weather[0].id}
|
||||||
description={day.weather[0].description}
|
description={day.weather[0].description}
|
||||||
/>
|
/>
|
||||||
@@ -182,6 +183,7 @@ const Search: React.FC = () => {
|
|||||||
date={new Date(hour.dt * 1000)}
|
date={new Date(hour.dt * 1000)}
|
||||||
time={true}
|
time={true}
|
||||||
data={hour.temp + '°C'}
|
data={hour.temp + '°C'}
|
||||||
|
temp={hour.temp > 25 ? 'hot' : hour.temp < 20 ? 'cold' : null}
|
||||||
icon={hour.weather[0].id}
|
icon={hour.weather[0].id}
|
||||||
description={hour.weather[0].description}
|
description={hour.weather[0].description}
|
||||||
/>
|
/>
|
||||||
@@ -209,10 +211,10 @@ const Search: React.FC = () => {
|
|||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<div className='error'>
|
<div className='error'>
|
||||||
<h2>{error}</h2>
|
<h2>{error}</h2>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
Reference in New Issue
Block a user