| | |
| | | DownloadOutlined, |
| | | StepBackwardOutlined, |
| | | StepForwardOutlined, |
| | | FastBackwardOutlined, |
| | | FastForwardOutlined, |
| | | DoubleRightOutlined, |
| | | DoubleLeftOutlined, |
| | | ForwardOutlined, |
| | |
| | | UserDeleteOutlined, |
| | | UserSwitchOutlined, |
| | | VideoCameraOutlined, |
| | | WifiOutlined |
| | | WifiOutlined, |
| | | TableOutlined |
| | | } from '@ant-design/icons' |
| | | |
| | | const MkIcons = { |
| | |
| | | 'download': (props) => <DownloadOutlined {...props} />, |
| | | 'step-backward': (props) => <StepBackwardOutlined {...props} />, |
| | | 'step-forward': (props) => <StepForwardOutlined {...props} />, |
| | | 'fast-backward': (props) => <FastBackwardOutlined {...props} />, |
| | | 'fast-forward': (props) => <FastForwardOutlined {...props} />, |
| | | 'double-right': (props) => <DoubleRightOutlined {...props} />, |
| | | 'double-left': (props) => <DoubleLeftOutlined {...props} />, |
| | | 'forward': (props) => <ForwardOutlined {...props} />, |
| | |
| | | 'user-switch': (props) => <UserSwitchOutlined {...props} />, |
| | | 'video-camera': (props) => <VideoCameraOutlined {...props} />, |
| | | 'wifi': (props) => <WifiOutlined {...props} />, |
| | | 'table': (props) => <TableOutlined {...props} />, |
| | | } |
| | | |
| | | class MkIcon extends Component { |
| | | render() { |
| | | const { type, ...resProps } = this.props |
| | | |
| | | if (!type || !MkIcons[type]) return null |
| | | if (!type) { |
| | | return null |
| | | } else if (MkIcons[type]) { |
| | | return ( |
| | | MkIcons[type](resProps) |
| | | ) |
| | | } else { |
| | | let svg = type |
| | | |
| | | return ( |
| | | MkIcons[type](resProps) |
| | | ) |
| | | if (!/<svg/.test(svg)) { |
| | | try { |
| | | svg = window.decodeURIComponent(window.atob(svg)) |
| | | if (!/<svg/.test(svg)) { |
| | | svg = '' |
| | | } |
| | | } catch (e) { |
| | | svg = '' |
| | | } |
| | | } |
| | | |
| | | return <span className={'anticon anticon-mk ' + (resProps.className || '')} style={resProps.style || null} dangerouslySetInnerHTML={{ __html: svg }}></span> |
| | | } |
| | | } |
| | | } |
| | | export default MkIcon |