@@ -3,7 +3,7 @@ import React, { HTMLAttributes, forwardRef, useState, useMemo } from 'react'
33import classNames from 'classnames'
44import './CIcon.css'
55
6- export interface CIconProps extends HTMLAttributes < SVGSVGElement > {
6+ export interface CIconProps extends Omit < HTMLAttributes < SVGSVGElement > , 'content' > {
77 /**
88 * A string of all className you want applied to the component.
99 */
@@ -17,7 +17,7 @@ export interface CIconProps extends HTMLAttributes<SVGSVGElement> {
1717 /**
1818 * Use for replacing default CIcon component classes. Prop is overriding the 'size' prop.
1919 */
20- customClassName ?: string | string [ ] // eslint-disable-line @typescript-eslint/ban-types
20+ customClassName ?: string | string [ ]
2121 /**
2222 * Name of the icon placed in React object or SVG content.
2323 */
@@ -136,30 +136,37 @@ export const CIcon = forwardRef<SVGSVGElement, CIconProps>(
136136 className ,
137137 )
138138
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+ </ >
163170 )
164171 } ,
165172)
0 commit comments