Skip to content

Commit

Permalink
feat(Icon): Add img tag and .png file support
Browse files Browse the repository at this point in the history
  • Loading branch information
JF-Cozy committed Oct 10, 2024
1 parent 49ef21b commit c1eeb5d
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions react/Icon/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,23 @@ function Icon(props) {
if (!icon) return null

const isIconComp = icon.type === Icon

if (isIconComp) return icon
const isImg = icon.type === 'img'

if (isIconComp || isImg) return icon

const isPngPath = typeof icon === 'string' && icon.includes('.png')

if (isPngPath)
return (
<img
src={icon}
className={className}
style={style}
width={width || size || DEFAULT_SIZE}
height={height || size || DEFAULT_SIZE}
{...restProps}
/>
)

const Svg = isFunction(icon) ? icon : makeSvgObject(icon)

Expand Down

0 comments on commit c1eeb5d

Please sign in to comment.