import SunCloud from 'mocpStatic/image/flight-support/Sun.png'
import rain from 'mocpStatic/image/flight-support/rain.png'
import Cloud from 'mocpStatic/image/flight-support/Cloud.png'
import snow from 'mocpStatic/image/flight-support/snow.png'

const weatherMsg = {
    '晴': SunCloud,
    '雨': rain,
    '阴': Cloud,
    '雪': snow
}

export const weatherIconFn = (txt) => {
    const text = txt.replace(/<[^>]*>?/gm, '')
    let weather
    for (let item in weatherMsg) {
        if (text.indexOf(item) > -1) {
            weather = weatherMsg[item]
        }
    }
    return weather || SunCloud
}
