import React from 'react'

class IconHtml extends React.Component<any, any> {
    constructor(props) {
        super(props);
    }

    componentDidMount(): void {

    }

    goDetail(href) {
        if (this.props.env == 'isMp') {
            this.props.goMpPath(href);
        }else{
            window.location.href = href;
        }
    }


    render() {
        let item = this.props.data;
        let CLASS = this.props.classBefore;
        return (
            <span>
                {
                    item.active == true ?
                        <span>
                            {
                                item.activeType == 1 ?
                                    <i className={CLASS + 'icon'}
                                       style={{
                                           backgroundImage: "url(" + (item.activeIcon) + ")"
                                       }}></i> :
                                    item.activeType == 2 ?
                                        <span className={
                                            "icon " + CLASS + "icon " +
                                            CLASS + "iconColor "
                                            + CLASS + "iconActive "
                                            + 'iconfont '
                                            + item.activeIcon
                                        }></span> : ""
                            }
                        </span>
                        :
                        <span>
                            {
                                item.type == 1 ?
                                    <i className={CLASS + 'icon'}
                                       style={{
                                           backgroundImage: "url(" + (item.icon) + ")"
                                       }}></i> :
                                    item.type == 2 ?
                                        <span className={
                                            "icon " + CLASS + "icon " +
                                            CLASS + "iconColor "
                                            + 'iconfont '
                                            + item.icon
                                        }></span> : ""
                            }
                        </span>

                }
            </span>
        );
    }
}

export default IconHtml;