"use client"; import React from "react"; import * as FluentIcons from "@fluentui/react-icons"; import { IconProps, iconSize } from "./types"; import IconContainer from "./IconContainer"; function Icon({ color, size = "small", isActive = true, name, nestedComponent, style, }: IconProps) { const fluentIcons = Object.assign( {}, ...Object.keys(FluentIcons).map((name: any) => { return { [name]: ( {React.createElement((FluentIcons as any)[name as any], { color: isActive ? color ?? undefined : undefined, style: { width: iconSize[size], height: iconSize[size] }, })} ), }; }) ); const icon = { ...fluentIcons, }; return icon[name]; } export default Icon;