Update temp conditions

This commit is contained in:
Hazem Krimi
2020-10-18 19:30:49 +01:00
parent f06ce416d0
commit e8362ecc73
2 changed files with 11 additions and 9 deletions
+3 -3
View File
@@ -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}
/> />
+4 -2
View File
@@ -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}
/> />