mirror of https://github.com/mue/mue.git
45 lines
800 B
JavaScript
45 lines
800 B
JavaScript
import { memo } from 'react';
|
|
|
|
import {
|
|
WiDaySunny,
|
|
WiNightClear,
|
|
WiDayCloudy,
|
|
WiNightCloudy,
|
|
WiCloud,
|
|
WiCloudy,
|
|
WiDayShowers,
|
|
WiNightShowers,
|
|
WiRain,
|
|
WiThunderstorm,
|
|
WiSnow,
|
|
WiFog,
|
|
} from 'react-icons/wi';
|
|
|
|
const iconMap = {
|
|
'01d': WiDaySunny,
|
|
'01n': WiNightClear,
|
|
'02d': WiDayCloudy,
|
|
'02n': WiNightCloudy,
|
|
'03d': WiCloud,
|
|
'03n': WiCloud,
|
|
'04d': WiCloudy,
|
|
'04n': WiCloudy,
|
|
'09d': WiDayShowers,
|
|
'09n': WiNightShowers,
|
|
'10d': WiRain,
|
|
'10n': WiRain,
|
|
'11d': WiThunderstorm,
|
|
'11n': WiThunderstorm,
|
|
'13d': WiSnow,
|
|
'13n': WiSnow,
|
|
'50d': WiFog,
|
|
'50n': WiFog,
|
|
};
|
|
|
|
function WeatherIcon({ name }) {
|
|
const IconComponent = iconMap[name];
|
|
return IconComponent ? <IconComponent className="weatherIcon" /> : null;
|
|
}
|
|
|
|
export default memo(WeatherIcon);
|