mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-04 23:02:07 +00:00
Group sidebar nav by purpose
Replaces the flat 16-item list with six sections (Overview, Operations, Vendors, Customers & Sites, Internal, System) and adds section titles that collapse into dividers when the sidebar is collapsed.
This commit is contained in:
parent
2a6fe6f35e
commit
a349a58822
2 changed files with 102 additions and 31 deletions
|
|
@ -19,29 +19,58 @@ import {
|
||||||
FaFileInvoiceDollar,
|
FaFileInvoiceDollar,
|
||||||
} from "react-icons/fa";
|
} from "react-icons/fa";
|
||||||
|
|
||||||
const navItems = [
|
const navGroups = [
|
||||||
{ label: "Dashboard", icon: <FaTachometerAlt />, path: "/" },
|
{
|
||||||
{ label: "Calendar", icon: <FaCalendarAlt />, path: "/calendar" },
|
title: "Overview",
|
||||||
{ label: "Documents", icon: <FaFileAlt />, path: "/documents" },
|
items: [
|
||||||
{ label: "Employees", icon: <FaUserTie />, path: "/employees" },
|
{ label: "Dashboard", icon: <FaTachometerAlt />, path: "/" },
|
||||||
{ label: "Accounts", icon: <FaMoneyCheckAlt />, path: "/accounts" },
|
{ label: "Calendar", icon: <FaCalendarAlt />, path: "/calendar" },
|
||||||
{ label: "Contacts", icon: <FaAddressBook />, path: "/contacts" },
|
{ label: "Reports", icon: <FaChartBar />, path: "/reports" },
|
||||||
{ label: "Reports", icon: <FaChartBar />, path: "/reports" },
|
],
|
||||||
{ label: "Work Orders", icon: <FaTools />, path: "/workorders" },
|
},
|
||||||
{ label: "Vendors", icon: <FaTruck />, path: "/vendors" },
|
{
|
||||||
{ label: "Vendor POs", icon: <FaFileInvoiceDollar />, path: "/vendor-pos" },
|
title: "Operations",
|
||||||
{ label: "Uplifts", icon: <FaDollarSign />, path: "/uplifts" },
|
items: [
|
||||||
{ label: "Follow Ups", icon: <FaBell />, path: "/followups" },
|
{ label: "Work Orders", icon: <FaTools />, path: "/workorders" },
|
||||||
{ label: "PM Schedules", icon: <FaClipboardList />, path: "/pmschedules" },
|
{ label: "Uplifts", icon: <FaDollarSign />, path: "/uplifts" },
|
||||||
{ label: "Assets", icon: <FaCubes />, path: "/assets" },
|
{ label: "Follow Ups", icon: <FaBell />, path: "/followups" },
|
||||||
{ label: "Locations", icon: <FaMapMarkerAlt />, path: "/locations" },
|
{ label: "PM Schedules", icon: <FaClipboardList />, path: "/pmschedules" },
|
||||||
{ label: "Settings", icon: <FaCog />, path: "/settings/dropdowns" },
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Vendors",
|
||||||
|
items: [
|
||||||
|
{ label: "Vendors", icon: <FaTruck />, path: "/vendors" },
|
||||||
|
{ label: "Vendor POs", icon: <FaFileInvoiceDollar />, path: "/vendor-pos" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Customers & Sites",
|
||||||
|
items: [
|
||||||
|
{ label: "Accounts", icon: <FaMoneyCheckAlt />, path: "/accounts" },
|
||||||
|
{ label: "Contacts", icon: <FaAddressBook />, path: "/contacts" },
|
||||||
|
{ label: "Locations", icon: <FaMapMarkerAlt />, path: "/locations" },
|
||||||
|
{ label: "Assets", icon: <FaCubes />, path: "/assets" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Internal",
|
||||||
|
items: [
|
||||||
|
{ label: "Employees", icon: <FaUserTie />, path: "/employees" },
|
||||||
|
{ label: "Documents", icon: <FaFileAlt />, path: "/documents" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "System",
|
||||||
|
items: [
|
||||||
|
{ label: "Settings", icon: <FaCog />, path: "/settings/dropdowns" },
|
||||||
|
],
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function Sidebar() {
|
export default function Sidebar() {
|
||||||
return (
|
return (
|
||||||
<aside className="sidebar">
|
<aside className="sidebar">
|
||||||
{/* Logo */}
|
|
||||||
<div className="logoRow">
|
<div className="logoRow">
|
||||||
<img
|
<img
|
||||||
src="/logo.png"
|
src="/logo.png"
|
||||||
|
|
@ -50,20 +79,30 @@ export default function Sidebar() {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="navTitle">NAVIGATION</div>
|
|
||||||
|
|
||||||
<ul className="navList">
|
<ul className="navList">
|
||||||
{navItems.map(({ label, icon, path }) => (
|
{navGroups.map((group, idx) => (
|
||||||
<li key={path}>
|
<li key={group.title} className="navGroup">
|
||||||
<NavLink
|
<div
|
||||||
to={path}
|
className={`navGroupTitle ${idx === 0 ? "navGroupTitleFirst" : ""}`}
|
||||||
className={({ isActive }) =>
|
|
||||||
`navItem ${isActive ? "active" : ""}`
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<span className="glyph">{icon}</span>
|
{group.title}
|
||||||
<span className="navLabel">{label}</span>
|
</div>
|
||||||
</NavLink>
|
<ul className="navGroupList">
|
||||||
|
{group.items.map(({ label, icon, path }) => (
|
||||||
|
<li key={path}>
|
||||||
|
<NavLink
|
||||||
|
to={path}
|
||||||
|
end={path === "/"}
|
||||||
|
className={({ isActive }) =>
|
||||||
|
`navItem ${isActive ? "active" : ""}`
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<span className="glyph">{icon}</span>
|
||||||
|
<span className="navLabel">{label}</span>
|
||||||
|
</NavLink>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,31 @@ body {
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.navGroup {
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navGroupList {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navGroupTitle {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 1.2px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: #9aa0a6;
|
||||||
|
margin-top: 18px;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
padding: 0 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navGroupTitleFirst {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.navList {
|
.navList {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
@ -167,10 +192,17 @@ body {
|
||||||
/* Hide text only */
|
/* Hide text only */
|
||||||
.app.nav-collapsed .navLabel,
|
.app.nav-collapsed .navLabel,
|
||||||
.app.nav-collapsed .logoText,
|
.app.nav-collapsed .logoText,
|
||||||
.app.nav-collapsed .navTitle {
|
.app.nav-collapsed .navTitle,
|
||||||
|
.app.nav-collapsed .navGroupTitle {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.app.nav-collapsed .navGroup + .navGroup {
|
||||||
|
border-top: 1px solid #e5e7eb;
|
||||||
|
margin-top: 8px;
|
||||||
|
padding-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Center icons */
|
/* Center icons */
|
||||||
.app.nav-collapsed .navItem {
|
.app.nav-collapsed .navItem {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue