From 74dffef97503a80170da451f8373fd4279282cb7 Mon Sep 17 00:00:00 2001 From: zhuyangbin Date: Tue, 12 May 2020 18:45:22 +0800 Subject: [PATCH] update --- components/IconFont/IconFont.js | 7 ------- components/IconFont/IconFont.ts | 7 +++++++ components/IconFont/index.js | 15 --------------- components/IconFont/index.tsx | 19 +++++++++++++++++++ 4 files changed, 26 insertions(+), 22 deletions(-) delete mode 100755 components/IconFont/IconFont.js create mode 100755 components/IconFont/IconFont.ts delete mode 100644 components/IconFont/index.js create mode 100644 components/IconFont/index.tsx diff --git a/components/IconFont/IconFont.js b/components/IconFont/IconFont.js deleted file mode 100755 index 5701a7b..0000000 --- a/components/IconFont/IconFont.js +++ /dev/null @@ -1,7 +0,0 @@ -import { Icon } from 'antd'; - -const IconFont = Icon.createFromIconfontCN({ - scriptUrl: '//at.alicdn.com/t/font_1509781_pkjtz0jd3g.js', -}); - -export default IconFont; diff --git a/components/IconFont/IconFont.ts b/components/IconFont/IconFont.ts new file mode 100755 index 0000000..ae84020 --- /dev/null +++ b/components/IconFont/IconFont.ts @@ -0,0 +1,7 @@ +import { createFromIconfontCN } from '@ant-design/icons'; + +const IconFont = createFromIconfontCN({ + scriptUrl: '//at.alicdn.com/t/font_1509781_7snuvbtppnq.js', +}); + +export default IconFont; diff --git a/components/IconFont/index.js b/components/IconFont/index.js deleted file mode 100644 index b675246..0000000 --- a/components/IconFont/index.js +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react'; -import { Icon } from 'antd'; -import IconFont from './IconFont'; -import styles from './styles.less'; - -const CustomIcon = props => { - const { type, iconFontType } = props; - const isHttp = /^((https|http)?:\/\/)[^\s]+/.test(type); - if (iconFontType) { - return - } - return isHttp ? icon : - -}; -export default CustomIcon \ No newline at end of file diff --git a/components/IconFont/index.tsx b/components/IconFont/index.tsx new file mode 100644 index 0000000..85a6ffc --- /dev/null +++ b/components/IconFont/index.tsx @@ -0,0 +1,19 @@ +import React from 'react'; +import IconFont from './IconFont'; +import styles from './styles.less'; + +interface IProps { + type?: string; + src?: string; +} +const CustomIcon = (props:IProps) => { + const { type, src } = props; + const isHttp = /^((https|http)?:\/\/)[^\s]+/.test(src || ''); + if (type) { + return ; + } if (src && isHttp) { + return icon; + } + return null; +}; +export default CustomIcon; -- 2.21.0