@@ -3,7 +3,7 @@ import React, { HTMLAttributes, forwardRef, useState, useMemo } from 'react'
3
3
import classNames from 'classnames'
4
4
import './CIcon.css'
5
5
6
- export interface CIconProps extends HTMLAttributes < SVGSVGElement > {
6
+ export interface CIconProps extends Omit < HTMLAttributes < SVGSVGElement > , 'content' > {
7
7
/**
8
8
* A string of all className you want applied to the component.
9
9
*/
@@ -17,7 +17,7 @@ export interface CIconProps extends HTMLAttributes<SVGSVGElement> {
17
17
/**
18
18
* Use for replacing default CIcon component classes. Prop is overriding the 'size' prop.
19
19
*/
20
- customClassName ?: string | string [ ] // eslint-disable-line @typescript-eslint/ban-types
20
+ customClassName ?: string | string [ ]
21
21
/**
22
22
* Name of the icon placed in React object or SVG content.
23
23
*/
@@ -136,30 +136,37 @@ export const CIcon = forwardRef<SVGSVGElement, CIconProps>(
136
136
className ,
137
137
)
138
138
139
- return use ? (
140
- < svg
141
- xmlns = "http://www.w3.org/2000/svg"
142
- className = { _className }
143
- { ...( height && { height : height } ) }
144
- { ...( width && { width : width } ) }
145
- role = "img"
146
- { ...rest }
147
- ref = { ref }
148
- >
149
- < use href = { use } > </ use >
150
- </ svg >
151
- ) : (
152
- < svg
153
- xmlns = "http://www.w3.org/2000/svg"
154
- viewBox = { viewBox }
155
- className = { _className }
156
- { ...( height && { height : height } ) }
157
- { ...( width && { width : width } ) }
158
- role = "img"
159
- dangerouslySetInnerHTML = { { __html : titleCode + iconCode } }
160
- { ...rest }
161
- ref = { ref }
162
- />
139
+ return (
140
+ < >
141
+ { use ? (
142
+ < svg
143
+ xmlns = "http://www.w3.org/2000/svg"
144
+ className = { _className }
145
+ { ...( height && { height : height } ) }
146
+ { ...( width && { width : width } ) }
147
+ role = "img"
148
+ aria-hidden = "true"
149
+ { ...rest }
150
+ ref = { ref }
151
+ >
152
+ < use href = { use } > </ use >
153
+ </ svg >
154
+ ) : (
155
+ < svg
156
+ xmlns = "http://www.w3.org/2000/svg"
157
+ viewBox = { viewBox }
158
+ className = { _className }
159
+ { ...( height && { height : height } ) }
160
+ { ...( width && { width : width } ) }
161
+ role = "img"
162
+ aria-hidden = "true"
163
+ dangerouslySetInnerHTML = { { __html : titleCode + iconCode } }
164
+ { ...rest }
165
+ ref = { ref }
166
+ />
167
+ ) }
168
+ { title && < span className = "visually-hidden" > { title } </ span > }
169
+ </ >
163
170
)
164
171
} ,
165
172
)
0 commit comments