Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#112 Ft minimize dashboard menu #127

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2f0727f
fix: remove placeholder property
ceelogre Aug 28, 2024
e00e63c
ft minimize dashboard menu
Prince-Kid Sep 13, 2024
543b06e
Merge branch 'develop' into ft-minimize-dashboard-menu
Prince-Kid Sep 16, 2024
e8fd5c7
fix minimize dashboard by icon and categorize into section
ManziPatrick Sep 17, 2024
009c3be
Merge branch 'ft-minimize-dashboard-menu' of https://github.com/atlp-…
ManziPatrick Sep 17, 2024
94d174a
fix minimize dashboard by icon and categorize into section
ManziPatrick Sep 17, 2024
1ce5df6
fix minimize dashboard by icon and categorize into section
ManziPatrick Sep 17, 2024
3ed5240
fix minimize dashboard by icon and categorize into section
ManziPatrick Sep 17, 2024
0308efc
fix minimize dashboard by icon and categorize into section
ManziPatrick Sep 17, 2024
224c9ab
fix minimize dashboard by icon and categorize into section
ManziPatrick Sep 17, 2024
3d09684
fix minimize dashboard by icon and categorize into section
ManziPatrick Sep 17, 2024
05c0acc
fix minimize dashboard by icon and categorize into section
ManziPatrick Sep 19, 2024
8c91c7c
fix minimize dashboard by icon and categorize into section
ManziPatrick Sep 19, 2024
db42e29
fix minimize dashboard scrollbar
ManziPatrick Sep 20, 2024
74721ea
fix minimize dashboard scrollbar
ManziPatrick Sep 20, 2024
466543b
fix minimize dashboard scrollbar
ManziPatrick Sep 20, 2024
f72e59c
Merge branch 'develop' of github.com:atlp-rwanda/atlp-devpulse-fn int…
Aime-Patrick Sep 20, 2024
d7eec64
Fix layout spacing between sidebar and main content in AdminLayout
Prince-Kid Sep 23, 2024
3d319bb
new
ManziPatrick Sep 23, 2024
d7d4517
Fix layout spacing between sidebar and main content in AdminLayout
Prince-Kid Sep 23, 2024
72788be
Merge branch 'develop' into ft-minimize-dashboard-menu
Prince-Kid Sep 23, 2024
15b93d0
fix layout
ManziPatrick Sep 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/components/sidebar/navslide.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* Custom scrollbar styles */
.custom-scrollbar::-webkit-scrollbar {
width: 6px; /* Width of the scrollbar */
}

.custom-scrollbar::-webkit-scrollbar-track {
background: #f1f1f1; /* Track color */
}

.custom-scrollbar::-webkit-scrollbar-thumb {
background-color: #888;
border-radius: 10px;
border: 1px solid #f1f1f1;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background-color: #555;
}

.custom-scrollbar {
scrollbar-width: thin;
scrollbar-color: #888 #f1f1f1;
}

149 changes: 47 additions & 102 deletions src/components/sidebar/sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,113 +1,58 @@
import React from 'react';
import React, { useState } from 'react';
import { Icon } from '@iconify/react';
import { Link, useNavigate } from 'react-router-dom';
import { generalSectionItems, managementSectionItems, applicationsSectionItems, performanceSectionItems, adminSectionItems, applicantSidebarItems, additionalSidebarItems } from './sidebarItems';
import "./navslide.css";

import { NavLink, Navigate } from 'react-router-dom';
import {
sidebarItems2,
sidebarItems1,
sidebarItems3,
applicantSidebarItems,
} from './sidebarItems';
import { BrowserRouter } from 'react-router-dom';
import { BrowserRouter as Router, Link } from 'react-router-dom';
import LogoutPage from '../../pages/LogoutPage';
import { Token } from '../../utils/utils';

const sidebar = () => {
const Sidebar = () => {
const [expanded, setExpanded] = useState(true);
const [openSections, setOpenSections] = useState({ general: true, management: true, applications: true, performance: true, admin: true, additional: true });
const roleName = localStorage.getItem('roleName');
console.log(roleName);
const sections = roleName === 'applicant' ? [{ title: 'Applicant Section', items: applicantSidebarItems }] : [
{ title: 'General', items: generalSectionItems },
{ title: 'Management', items: managementSectionItems },
{ title: 'Applications', items: applicationsSectionItems },
{ title: 'Performance', items: performanceSectionItems },
{ title: 'Admin', items: adminSectionItems },
{ title: 'Additional', items: additionalSidebarItems }
];

const toggleSection = (section) => setOpenSections(prev => ({ ...prev, [section]: !prev[section] }));
const handleLogout = () => { localStorage.clear(); useNavigate()('/login'); };

return (
<>
<div className="top-0 bottom-0 overflow-y-scroll mt-[70px] w-[16rem] grow z-10 fixed dark:bg-dark-bg bg-white font-sans border-r border-[#979797] ">
{roleName === 'applicant' ? (
<div className="mb-2 border-b border-[#000] h-[70%]">
<ul className=" min:mt-0 pl-4 block mt-2">
{applicantSidebarItems.map((items, index) => {
return (
<li
key={index}
className=" min:text-xl lg:justify-content-start align-items-center dark:text-white text-[#173B3F] text-base"
>
<Link
to={items.path}
className="is-active focus:text-green-600 p-1 flex align-items-center leading-3 cursor-pointer font-semibold hover:font-bold "
>
<label className="mr-3 p-1">{items.icon}</label>
<label className="p-1 ">{items.title} </label>
<div className={`top-0 mt-[70px] ${expanded ? 'w-[16rem]' : 'w-[4rem]'} fixed z-10 dark:bg-dark-bg bg-white border-r transition-width duration-300 h-screen overflow-y-auto custom-scrollbar`}>
<button onClick={() => setExpanded(!expanded)} className="p-1.5 rounded-lg bg-gray-50 absolute top-2 right-2 z-20">
<Icon icon={expanded ? 'material-symbols:menu-open' : 'mdi:menu-close'} color="#000" />
</button>
<div className="pt-12 pb-12 mb-20">
{sections.map((section, idx) => (
<div key={idx}>
<div onClick={() => toggleSection(section.title.toLowerCase())} className="cursor-pointer p-2 flex items-center justify-between text-white">
{expanded && <span className="font-bold">{section.title}</span>}
<Icon icon={openSections[section.title.toLowerCase()] ? 'akar-icons:chevron-down' : 'akar-icons:chevron-right'} />
</div>
{openSections[section.title.toLowerCase()] && (
<ul className="pl-4 mt-2">
{section.items.map((item, index) => (
<li key={index} className="flex items-center text-white">
<Link to={item.path} className="p-1 flex items-center">
<span className="mr-3">{item.icon}</span>
{expanded && <span>{item.title}</span>}
</Link>
</li>
);
})}
{/* <li className=" min:text-xl lg:justify-content-start align-items-center dark:text-white text-[#173B3F] text-base">
<LogoutPage />
</li> */}
</ul>
))}
</ul>
)}
</div>
) : (
<div className="mb-2 border-b border-[#000] ">
<ul className=" min:mt-0 pl-4 block mt-2">
{sidebarItems1.map((items, index) => {
return (
<li
key={index}
className=" min:text-xl lg:justify-content-start align-items-center dark:text-white text-[#173B3F] text-base"
>
<Link
to={items.path}
className="is-active focus:text-green-600 p-1 flex align-items-center leading-3 cursor-pointer font-semibold hover:font-bold "
>
<label className="mr-3 p-1">{items.icon}</label>
<label className="p-1 ">{items.title} </label>
</Link>
</li>
);
})}
</ul>
</div>
)}

<div className="mb-3">
<ul className="pl-4 block mt-2 md:mt-0">
{sidebarItems2.map((items, index) => {
return (
<li
key={index}
className=" align-items-center dark:text-white text-[#173B3F] text-base"
>
<a
href={items.path}
className="p-1 flex align-items-center leading-3 cursor-pointer font-semibold hover:font-bold"
>
<label className="mr-3 p-1">{items.icon}</label>
<label className="p-1">{items.title} </label>
</a>
</li>
);
})}
</ul>
</div>
<div className="inset-x-0 bottom-2 mt-20">
<ul className="px-20 flex justify-content-center">
{sidebarItems3.map((items, index) => {
return (
<li
key={index}
className=" justify-content-center mb-1 align-items-center dark:text-white text-[#173B3F] text-lg ml-2"
>
<a
href={items.path}
className="p-1 flex align-items-center leading-5 cursor-pointer"
>
<label className="mr-3 p-1">{items.icon}</label>
</a>
</li>
);
})}
</ul>
</div>
))}
<button onClick={handleLogout} className="flex items-center p-1 font-semibold hover:font-bold text-white focus:outline-none">
<Icon icon="nimbus:arrow-left" className="mr-3" />
{expanded && <span>Logout</span>}
</button>
</div>
</>
</div>
);
};
export default sidebar;

export default Sidebar;
Loading
Loading