mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add checks for svg, use only typeof material === string
Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>
This commit is contained in:
parent
da3c8d00c7
commit
c55b2fa1ae
@ -114,14 +114,14 @@ export class Icon extends React.PureComponent<IconProps> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// render as inline svg-icon
|
// render as inline svg-icon
|
||||||
if (svg) {
|
if (typeof svg === "string") {
|
||||||
const svgIconText = svg.includes("<svg") ? svg : require(`!!raw-loader!./${svg}.svg`).default;
|
const svgIconText = svg.includes("<svg") ? svg : require(`!!raw-loader!./${svg}.svg`).default;
|
||||||
|
|
||||||
iconContent = <span className="icon" dangerouslySetInnerHTML={{ __html: svgIconText }}/>;
|
iconContent = <span className="icon" dangerouslySetInnerHTML={{ __html: svgIconText }}/>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// render as material-icon
|
// render as material-icon
|
||||||
if (material && typeof material === "string") {
|
if (typeof material === "string") {
|
||||||
iconContent = <span className="icon" data-icon-name={material}>{material}</span>;
|
iconContent = <span className="icon" data-icon-name={material}>{material}</span>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user