I'm building a component which displays SVG icons from the public folder. The component accepts name, height, width and color and should return the according icon in the right size and color. Here's what I tried:
type Props = {
name: string;
height: number;
width: number;
color?: string;
};
const Icon = ({ name, height, width, color }: Props): ReactElement => {
const path = `/icons/${name}.svg`;
return (
<div>
<Image src={path} alt="" height={height} width={width} color={color}/>
</div>
);
};
The icon gets displayed when I use the component (e.g. <Icon name="student" width={64} height={64} color="#03fc94"/>
) but I cannot change the color, even when I hard-code it. It just won't change- I tried following properties: color, stroke, style, fill. I also tried changing the color with CSS.
In the icon itself I changed the "fill" property in to "currentColor". Any ideas?