diff --git a/src/components/Dashboard/DashboardHome.tsx b/src/components/Dashboard/DashboardHome.tsx index 01c95fc..97ddcf3 100644 --- a/src/components/Dashboard/DashboardHome.tsx +++ b/src/components/Dashboard/DashboardHome.tsx @@ -3,7 +3,7 @@ import { DefaultCard } from "../" export default function DashboardHome() { return (
-
+
{/* cards display */} -
+
{console.log('working')}} />
-
+
{console.log('working')}} />
-
+
void +} + +export default function Aside({asideDisplay}:Props) { const {pathname} = useLocation() const navigate = useNavigate() + const [openNestedLink, setOpenNestedLink] = useState<{name:string|null}>({name: ''}) + + const handleOpenNestedLink = (e:any) => { + if(!e || !e.target){ + return setOpenNestedLink({name: ''}) + } + if(openNestedLink.name && openNestedLink.name == e.target.name){ + setOpenNestedLink({name: ''}) + }else{ + setOpenNestedLink({name: e.target.name}) + } + } + return ( -
+

AC

-
- {asideLinks.map((link, index) => ( - - - {link.name} - - ))} +
+ {asideLinks.map((link, index) => { + if(link.nestedLink?.length){ + let allNestedLinks = link.nestedLink.map(item => item.link) + return ( +
+ +
+ {link.nestedLink.map((nextLink, index) => ( + {asideDisplay && asideDisplay()}} + key={index} + to={nextLink.link ? nextLink.link : '#'} + className={`w-full my-1 flex items-center gap-2 py-2 pl-5 text-base font-medium border-l-2 ${pathname == nextLink.link ? 'border-[#5C2684] text-[#5C2684]' : 'border-transparent text-[#585858]'}`} + > + + {nextLink.name} + + ))} +
+
+ ) + }else{ + return( + {asideDisplay && asideDisplay()}} + key={index} + to={link.link ? link.link : '#'} + className={`w-full my-4 flex items-center gap-2 py-2 pl-5 rounded-lg text-base font-medium border-2 ${pathname == link.link ? 'border-[#5C2684] text-[#5C2684]' : 'border-transparent text-[#585858]'}`} + > + + {link.name} + + ) + } + })}