mirror of
https://github.com/zuiidea/antd-admin
synced 2026-10-31 06:23:47 +00:00
merge #332
This commit is contained in:
@@ -1,21 +1,24 @@
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import classnames from 'classnames'
|
||||
import './iconfont.less'
|
||||
|
||||
const Iconfont = ({ type, colorful }) => {
|
||||
const Iconfont = ({ type, colorful = false, className }) => {
|
||||
if (colorful) {
|
||||
return (<span
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `<svg class="colorful-icon" aria-hidden="true"><use xlink:href="#${type.startsWith('#') ? type.replace(/#/, '') : type}"></use></svg>`,
|
||||
}}
|
||||
/>)
|
||||
return (
|
||||
<svg className={classnames('colorful-icon', className)} aria-hidden="true">
|
||||
<use xlinkHref={`#${type.startsWith('#') ? type.replace(/#/, '') : type}`} />
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
return <i className={`antdadmin icon-${type}`} />
|
||||
|
||||
return <i className={classnames('antdadmin', [`icon-${type}`], className)} />
|
||||
}
|
||||
|
||||
Iconfont.propTypes = {
|
||||
type: PropTypes.string,
|
||||
type: PropTypes.string.isRequired,
|
||||
colorful: PropTypes.bool,
|
||||
className: PropTypes.string,
|
||||
}
|
||||
|
||||
export default Iconfont
|
||||
|
||||
Reference in New Issue
Block a user