Files
mue/src/components/widgets/weather/WeatherIcon.jsx
alexsparkes 99569f3781 fix: clock colour among other things
Co-authored-by: David Ralph <me@davidcralph.co.uk>
2022-08-31 18:45:42 +01:00

53 lines
1.3 KiB
JavaScript

import {
WiDaySunny,
WiNightClear,
WiDayCloudy,
WiNightCloudy,
WiCloud,
WiCloudy,
WiDayShowers,
WiNightShowers,
WiRain,
WiThunderstorm,
WiSnow,
WiFog,
} from 'react-icons/wi';
export default function WeatherIcon({ name }) {
// name is the openweathermap icon name, see https://openweathermap.org/weather-conditions
switch (name) {
case '01d':
return <WiDaySunny className="weatherIcon"/>;
case '01n':
return <WiNightClear className="weatherIcon"/>;
case '02d':
return <WiDayCloudy className="weatherIcon" />;
case '02n':
return <WiNightCloudy className="weatherIcon"/>;
case '03d':
case '03n':
return <WiCloud className="weatherIcon"/>;
case '04d':
case '04n':
return <WiCloudy className="weatherIcon"/>;
case '09d':
return <WiDayShowers className="weatherIcon"/>;
case '09n':
return <WiNightShowers className="weatherIcon" />;
case '10d':
case '10n':
return <WiRain className="weatherIcon" />;
case '11d':
case '11n':
return <WiThunderstorm className="weatherIcon" />;
case '13d':
case '13n':
return <WiSnow className="weatherIcon" />;
case '50d':
case '50n':
return <WiFog className="weatherIcon" />;
default:
return null;
}
}