// @mui
import Box from '@mui/material/Box';
import Link from '@mui/material/Link';
import Tooltip from '@mui/material/Tooltip';
import ListItemText from '@mui/material/ListItemText';
// routes
import { RouterLink } from 'src/routes/components';
//
import Iconify from '../../iconify';
//
import { NavItemProps, NavConfigProps } from '../types';
import { StyledItem, StyledIcon, StyledDotIcon } from './styles';
// ----------------------------------------------------------------------
type Props = NavItemProps & {
config: NavConfigProps;
};
export default function NavItem({
item,
open,
depth,
active,
config,
externalLink,
...other
}: Props) {
const { title, path, icon, info, children, disabled, caption, roles } = item;
const subItem = depth !== 1;
const renderContent = (
<>
{icon && {icon}}
{subItem && (
)}
>
{!(config.hiddenLabel && !subItem) && (
{caption}
) : null
}
primaryTypographyProps={{
noWrap: true,
typography: 'body2',
textTransform: 'capitalize',
fontWeight: active ? 'fontWeightSemiBold' : 'fontWeightMedium',
}}
secondaryTypographyProps={{
noWrap: true,
component: 'span',
typography: 'caption',
color: 'text.disabled',
}}
/>
)}
{info && (
{info}
)}
{!!children && (
)}
);
// Hidden item by role
if (roles && !roles.includes(`${config.currentRole}`)) {
return null;
}
// External link
if (externalLink)
return (
{renderContent}
);
// Has child
if (children) {
return renderContent;
}
// Default
return (
{renderContent}
);
}