mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
svg support in icons.tsx (#7266)
This commit is contained in:
parent
3d4d2b50ae
commit
35701f5899
3 changed files with 75 additions and 0 deletions
|
@ -3,6 +3,8 @@ import { ComponentType, ReactNode, useEffect } from 'react';
|
|||
import featherIcons from 'feather-icons';
|
||||
import { isValidElementType } from 'react-is';
|
||||
|
||||
import Svg, { SvgIcons } from './Svg';
|
||||
|
||||
export interface IconProps {
|
||||
icon: ReactNode | ComponentType<unknown>;
|
||||
featherIcon?: boolean;
|
||||
|
@ -51,6 +53,11 @@ export function Icon({ icon, feather, className, mode, size }: Props) {
|
|||
);
|
||||
}
|
||||
|
||||
if (icon.indexOf('svg-') === 0) {
|
||||
const svgIcon = icon.replace('svg-', '');
|
||||
return <Svg icon={svgIcon as keyof typeof SvgIcons} className={classes} />;
|
||||
}
|
||||
|
||||
if (feather) {
|
||||
return (
|
||||
<i
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue