blob: 31102ee818060598d62787451820205b37b29efd [file] [log] [blame]
Jiarenxiang38dcb052025-03-13 16:40:09 +08001import * as AntdIcons from '@ant-design/icons';
2import React from 'react';
3
4const allIcons: Record<string, any> = AntdIcons;
5
6export function getIcon(name: string): React.ReactNode | string {
7 const icon = allIcons[name];
8 return icon || '';
9}
10
11export function createIcon(icon: string | any): React.ReactNode | string {
12 if (typeof icon === 'object') {
13 return icon;
14 }
15 const ele = allIcons[icon];
16 if (ele) {
17 return React.createElement(allIcons[icon]);
18 }
19 return '';
20}