import type { HTMLAttributes } from 'react';
import React from 'react';

type IconProps = HTMLAttributes<HTMLSpanElement> & {
    icon?: string;
};

const IconFont: React.FC<IconProps> = (props) => {
    const { icon, className, style, ...restProps } = props;
    if (!icon) {
        return null;
    }
    return (
        <span
            className={`iconfont icon-${icon} ${className ?? ''}`}
            style={{
                ...style,
            }}
            {...restProps}
        />
    );
};

export default IconFont;
