import React from "react" import { MenuIcon as MenuIconName, MenuIconType } from "@/core/menu/types" import EvaIcon from "react-eva-icons" import { createStyles, makeStyles, Theme, useTheme } from "@material-ui/core/styles" import { Icon } from "@material-ui/core" const useStyles = makeStyles((theme: Theme) => createStyles({ root: { color: theme.bunadmin.iconColor, display: "flex", justifyContent: "center", alignItems: "center" }, nested: { paddingLeft: theme.spacing(4) } }) ) interface Props { name?: string icon: MenuIconName icon_type: MenuIconType } export default function MenuIcon({ name, icon, icon_type }: Props) { const theme = useTheme() const classes = useStyles() if (!icon || !icon_type) return Icon switch (icon_type) { case "eva": return ( ) case "material": return ( {icon} ) case "url": return ( {name} ) default: return Icon } }