import { IconProps } from './index'; import * as React from 'react'; import classNames from 'classnames'; import { svgBaseProps } from './CustomIcon'; import { getComputedSvgStyle } from './utils'; const customCache = new Set(); export interface CustomIconOptions { namespace?: string; prefix?: string; scriptUrl?: string; extraCommonProps?: { [key: string]: any }; } export interface IconFontProps extends IconProps { viewBox?: string; } export default function create(options: CustomIconOptions = {}): React.ComponentClass { const { namespace, prefix = '', scriptUrl, extraCommonProps = {} } = options; class Custom extends React.Component { render() { const { type, className = '', spin, flip, svgClassName, tag = 'i', onClick, style, rotate = 0, svgStyle = {}, viewBox = '0 0 1024 1024', } = this.props; const classString = classNames( { anticon: true, 'anticon-spin': spin || type === 'loading', }, className, ); const innerSvgProps = { ...svgBaseProps, viewBox, className: svgClassName, style: getComputedSvgStyle({ rotate, flip }, svgStyle), }; return React.createElement( tag, { className: classString, style, onClick, }, , ); } componentDidMount() { /** * DOM API required. * Make sure in browser environment. * The Custom Icon will create a