github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/ui/dashboard/src/components/Icon/index.tsx (about)

     1  import useDashboardIcons from "../../hooks/useDashboardIcons";
     2  
     3  type IconProps = {
     4    className?: string;
     5    icon: string;
     6    style?: any;
     7    title?: string;
     8  };
     9  
    10  const Icon = ({ className = "h-6 w-6", icon, style, title }: IconProps) => {
    11    const icons = useDashboardIcons();
    12    let MatchingIcon = icons.materialSymbols[icon];
    13  
    14    if (MatchingIcon) {
    15      return (
    16        <MatchingIcon
    17          className={className}
    18          style={{
    19            fill: "currentColor",
    20            color: style ? style.color : undefined,
    21          }}
    22          title={title}
    23        />
    24      );
    25    } else {
    26      MatchingIcon = icons.heroIcons[icon];
    27    }
    28  
    29    if (!MatchingIcon) {
    30      return null;
    31    }
    32  
    33    return <MatchingIcon className={className} style={style} title={title} />;
    34  };
    35  
    36  export default Icon;