/**
 * 内部组件-左侧图标，右侧名称和数值
 */
import React from 'react';
import './style';

export interface ImageTextProps {
    src: string;
    name: string;
    value: number;
    unit: string;
    /** 默认白色，active为--info-active */
    color?: string;
    style?: Object;
}

const ImageText: React.FC<ImageTextProps> = props => {
    const { src, name, value, unit, color, style } = props;
    return (
        <div className="vm-image-text-item" style={style}>
            <img src={src} />
            <div>
                <div className="vm-image-text-item--name">{name}</div>
                <div className={`vm-image-text-item--value ${color}`}>
                    <span>{value || 0}</span>
                    {unit}
                </div>
            </div>
        </div>
    );
};

export default ImageText;
