import React from 'react' // 定义 props 的类型 interface IconComProps { type?: string; width?: number | string; height?: number | string; fill?: string; _style?: React.CSSProperties; } const userSvg = ({ width = 20, height = 20, fill = '#1677FF' }: IconComProps) => { return } const codeSvg = ({ width = 20, height = 20, fill = '#1677FF' }: IconComProps) => { return } const searchSvg = ({ width = 20, height = 20, fill = '#1677FF' }: IconComProps) => { return } const sureSvg = ({ width = 20, height = 20, fill = '#1677FF' }: IconComProps) => { return } const errorSvg = ({ width = 20, height = 20, fill = '#1677FF' }: IconComProps) => { return } const warnSvg = ({ width = 20, height = 20, fill = '#1677FF' }: IconComProps) => { return } const infoSvg = ({ width = 20, height = 20, fill = '#1677FF' }: IconComProps) => { return } const listSvg = ({ width = 20, height = 20, fill = '#1677FF' }: IconComProps) => { return } const svgInit = (type: string, props: IconComProps) => { const typeSvg: { [key: string]: React.ReactNode; } = { user: userSvg(props), code: codeSvg(props), search: searchSvg(props), sure: sureSvg(props), error: errorSvg(props), warn: warnSvg(props), info: infoSvg(props), list: listSvg(props), } return typeSvg[type] ? typeSvg[type] : null } const IconCom: React.FC = (props: IconComProps = {}) => { // 样式content无效, https://www.iconfont.cn/collections/detail?spm=a313x.collections_index.i1.d9df05512.6d153a81fkRhvT&cid=9402 const { type = "", _style = {}, } = props; return (
{ svgInit(type, props) }
) } export default IconCom