2025-07-29 17:41:13 -04:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
import React, { useState, ComponentType } from 'react';
|
|
|
|
|
import classnames from 'classnames';
|
|
|
|
|
|
|
|
|
|
import DynamicIcon from './DynamicIcon';
|
|
|
|
|
import { NavItems } from '@/lib/dashboard';
|
|
|
|
|
|
|
|
|
|
import { FaArrowCircleLeft, FaArrowCircleRight } from "react-icons/fa";
|
|
|
|
|
import { TbCircleArrowLeft, TbCircleArrowRight } from "react-icons/tb";
|
|
|
|
|
import { PiBreadFill } from "react-icons/pi";
|
|
|
|
|
|
|
|
|
|
import Button from './Button';
|
2026-07-23 10:38:20 -04:00
|
|
|
import { usePathname } from 'next/navigation';
|
2025-07-29 17:41:13 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
interface SideNavProps {
|
|
|
|
|
maxWidth: string;
|
|
|
|
|
bgColor: string;
|
|
|
|
|
navItems: NavItems[];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const SideNav: React.FC<SideNavProps> = (
|
|
|
|
|
{
|
|
|
|
|
maxWidth,
|
|
|
|
|
bgColor,
|
|
|
|
|
navItems
|
|
|
|
|
}
|
|
|
|
|
) => {
|
|
|
|
|
|
|
|
|
|
const [isSidebarOpen, setIsSidebarOpen] = useState(true);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className={classnames(
|
|
|
|
|
"relative h-full flex flex-col text-deepcove text-center transition-all duration-500",
|
2025-07-30 16:31:41 -04:00
|
|
|
bgColor,
|
2025-07-29 17:41:13 -04:00
|
|
|
{
|
2025-08-04 14:16:42 -04:00
|
|
|
"w-[6vw] lg:w-[5vw]" : !isSidebarOpen,
|
|
|
|
|
"w-[13vw] lg:w-[11vw]" : isSidebarOpen
|
2025-07-29 17:41:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
)}>
|
2026-07-23 10:38:20 -04:00
|
|
|
<div className="h-20" />
|
|
|
|
|
{/* <Button
|
2025-07-29 17:41:13 -04:00
|
|
|
onClick={() => setIsSidebarOpen(!isSidebarOpen)}
|
|
|
|
|
className="h-10 flex justify-end items-center pr-2"
|
|
|
|
|
>
|
|
|
|
|
{isSidebarOpen ? <FaArrowCircleLeft size={30} /> : <FaArrowCircleRight size={30} />}
|
2026-07-23 10:38:20 -04:00
|
|
|
</Button> */}
|
2025-07-30 16:31:41 -04:00
|
|
|
<div className="flex flex-col divide-y divide-bluetang">
|
2025-07-29 17:41:13 -04:00
|
|
|
{navItems.map((navItem, index) => (
|
2026-07-23 10:38:20 -04:00
|
|
|
<a href={navItem.url} key={index} className={classnames(
|
2025-08-04 14:16:42 -04:00
|
|
|
"w-full h-20 flex justify-center items-center px-1 text-xs md:text-sm lg:text-base font-semibold hover:text-platinum",
|
2026-07-23 10:38:20 -04:00
|
|
|
{"bg-bluetang text-platinum" : usePathname() == navItem.url}
|
2025-07-29 17:41:13 -04:00
|
|
|
)}>
|
|
|
|
|
{isSidebarOpen ? (
|
|
|
|
|
<>{navItem.title}</>
|
|
|
|
|
) : (
|
|
|
|
|
<DynamicIcon iconName={navItem.iconName} size={30} />
|
|
|
|
|
)}
|
|
|
|
|
</a>
|
|
|
|
|
))}
|
2025-07-30 16:31:41 -04:00
|
|
|
</div>
|
2025-07-29 17:41:13 -04:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default SideNav;
|