import { ChevronUp16 } from "@carbon/icons-react"; import React, { Fragment } from "react"; import { NavLink, useLocation } from "react-router-dom"; const SidebarItem = (props: any) => { const { item, listActiveMenu } = props; const location = useLocation(); const [expanded, setExpand] = React.useState( location.pathname.includes(item?.link) ); const handleExpand = React.useCallback((e) => { e.preventDefault(); setExpand((expanded) => !expanded); }, []); return (
{item?.name}
{expanded && (
{item?.children.map((menu: any, index: any) => { const key = `${item.label}-${index}`; if (menu?.children) { return ( ); } return ( {item.show && (
0 && menu.link.includes(listActiveMenu[0]) ? "active" : "" } > {menu?.name}
)}
); })}
)}
); }; export default SidebarItem;