/*
 * @Author: 赵伟
 * @Date: 2024-04-17 12:53:06
 * @Description: 封装 iconfont 组件
 */
import '@/iconfont/iconfont-menu.js';
import '@/iconfont/iconfont.js';
import { createFromIconfontCN } from '@ant-design/icons';

const Icon = createFromIconfontCN({
  scriptUrl: '',
});

type IconFontProps = Parameters<typeof Icon>[0];

interface KFIconProps extends IconFontProps {
  type: string;
  font?: number;
  color?: string;
  style?: React.CSSProperties;
  className?: string;
}

function KFIcon({ type, font = 15, color = '', style = {}, className, ...rest }: KFIconProps) {
  const iconStyle = {
    ...style,
    fontSize: font,
    color,
  };
  return <Icon {...rest} type={type} className={className} style={iconStyle} />;
}

export default KFIcon;
