import React, { useState } from "react"; import { Box, VStack, Link, Stack, Text, Image, Flex } from "@chakra-ui/react"; import { Link as RouterLink } from "react-router-dom"; import { MdDashboard } from "react-icons/md"; import logo from "../../public/images/logo/logo.png"; import { FaChevronUp } from "react-icons/fa"; import { FaChevronDown } from "react-icons/fa"; import { IoDocumentTextOutline } from "react-icons/io5"; import { FiEdit } from "react-icons/fi"; import { FaRegUser } from "react-icons/fa"; import { IoBag } from "react-icons/io5"; import { MdGroups } from "react-icons/md"; import { BiSupport } from "react-icons/bi"; import { GiDatabase } from "react-icons/gi"; const Sidebar = () => { const [activeSection, setActiveSection] = useState("dashboard"); const toggleSection = (section) => { setActiveSection(activeSection === section ? null : section); }; return ( {sidebarItems.map((item) => ( toggleSection(item.value)} w="254px" > {/* */} {item.icon} {item.title} {item.links && ( {activeSection === item.value ? ( ) : ( )} )} {/* Sub-links */} {item.links && activeSection === item.value && ( {item.links.map((link) => ( {link.label} ))} )} ))} ); }; const sidebarItems = [ { value: "dashboard", title: "Dashboard", route: "/", icon: , }, { value: "manageuser", title: "Manage User", links: [ { label: "Register Users", path: "/manage-users/register-users" }, { label: "Deactivated Accounts", path: "/manage-users/deactivated-accs" }, ], icon: , }, { value: "managePost", title: "Manage Post", icon: , }, { value: "manageSubAdmin", title: "Manage Sub-Admin", icon: , }, { value: "manageJobs", title: "Manage Jobs", icon: , }, { value: "manageGroups", title: "Manage Groups", icon: , }, { value: "manageContactUs", title: "Manage Contact Us", icon: , }, { value: "manageCms", title: "Manage CMS", links: [ { label: "Profile", path: "/settings/profile" }, { label: "Preferences", path: "/settings/preferences" }, ], icon: , }, { value: "myprofle", title: "My Profile", links: [ { label: "Settings", path: "/master/settings" }, { label: "Modules", path: "/master/modules" }, ], icon: , }, { value: "masterModule", title: "Master Module", links: [ { label: "Settings", path: "/master/settings" }, { label: "Modules", path: "/master/modules" }, ], icon: , }, ]; export default Sidebar;