2022-12-09 11:48:15 +00:00
|
|
|
import { ListItem, ListItemButton, ListItemIcon, ListItemText, useTheme } from "@mui/material";
|
|
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
icon: any;
|
|
|
|
text: string;
|
|
|
|
isActive?: boolean;
|
2023-12-17 22:34:22 +00:00
|
|
|
disabled?: boolean;
|
2022-12-09 11:48:15 +00:00
|
|
|
isCollapsed: boolean;
|
|
|
|
onClick: () => void;
|
|
|
|
}
|
|
|
|
|
2023-12-17 22:34:22 +00:00
|
|
|
export default function MenuItem({ icon, text, isActive = false, isCollapsed, onClick, disabled = false }: Props) {
|
2022-12-09 11:48:15 +00:00
|
|
|
const theme = useTheme();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ListItem
|
|
|
|
sx={{
|
|
|
|
px: 0,
|
2023-12-01 20:45:35 +00:00
|
|
|
pt: "5px",
|
|
|
|
pb: "3px"
|
2022-12-09 11:48:15 +00:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
<ListItemButton
|
|
|
|
onClick={onClick}
|
2023-12-17 22:34:22 +00:00
|
|
|
disabled={disabled}
|
2022-12-09 11:48:15 +00:00
|
|
|
sx={{
|
|
|
|
py: "4px",
|
|
|
|
gap: "14px",
|
|
|
|
backgroundColor: isActive ? theme.palette.darkPurple.main : undefined,
|
|
|
|
justifyContent: "center",
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<ListItemIcon sx={{ minWidth: 0 }}>
|
|
|
|
{icon}
|
|
|
|
</ListItemIcon>
|
|
|
|
{!isCollapsed &&
|
|
|
|
<ListItemText
|
|
|
|
primary={text}
|
|
|
|
primaryTypographyProps={{
|
|
|
|
fontSize: "16px",
|
|
|
|
lineHeight: "20px",
|
|
|
|
color: "white",
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
</ListItemButton>
|
|
|
|
</ListItem>
|
|
|
|
);
|
|
|
|
}
|