Skip to content

Commit cce5c23

Browse files
author
Tomasz John
committed
fix: ...rest attributes for IMG tag added
1 parent 31bfa1b commit cce5c23

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/CIcon.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { HTMLAttributes, FC, useState, useMemo } from 'react'
22
import classNames from 'classnames'
33
import './CIcon.css'
44

5-
export interface CIconProps extends HTMLAttributes<SVGSVGElement> {
5+
export interface CIconProps extends HTMLAttributes< SVGSVGElement | HTMLImageElement > {
66
/**
77
* A string of all className you want applied to the component. [docs]
88
*/
@@ -118,9 +118,13 @@ const CIcon: FC<CIconProps> = ({
118118
className
119119
)
120120
}
121-
122121
//const classes = customClasses || computedClasses
123122

123+
// let restImg: HTMLAttributes<HTMLImageElement> = {}
124+
// if (src && !use) {
125+
// restImg = rest as HTMLAttributes<HTMLImageElement>
126+
// }
127+
124128
return (
125129
<React.Fragment>
126130
{ !src && !use &&
@@ -135,6 +139,7 @@ const CIcon: FC<CIconProps> = ({
135139
}
136140
{ src && !use &&
137141
<img
142+
{...rest}
138143
className={className}
139144
src={src}
140145
role="img"

0 commit comments

Comments
 (0)