Currently I am adding icons manually, but for a couple of icons this way is not problematic. But in case of 100 icons it becomes a really problem. How can I make this reusable. So I can apply this element so it can be any icon I want. In the end it should look like this for instance.
<Icon icon='login' color="yellow" mr="10px" fontSize="20px" />
// styled components
import { Facebook } from "@styled-icons/boxicons-logos/Facebook";
import { Instagram } from "@styled-icons/boxicons-logos/Instagram";
export const FaceBookIcon = styled(Facebook)`
${typography}
${space}
${layout}
${color}
`;
export const InstagramIcon = styled(Instagram)`
${typography}
${space}
${layout}
${color}
`;
// icons.tsx
import React from "react";
import { FaceBookIcon, InstagramIcon } from "./icon.styles";
export interface IconProps {
width?: number;
bg?: string;
color?: string;
}
export const Icon: React.FC<IconProps> = ({
width,
bg,
color,
...props
}) => {
return (
<div>
<FaceBookIcon width={60} bg={"black"} color={"white"}/>
<InstagramIcon width={60} bg={"black"} color={"white"}/>
</div>
);
};