Skip to content

Commit fa8aaf9

Browse files
committed
Finished updating Sidebar to match Figma
1 parent 787a3e9 commit fa8aaf9

4 files changed

Lines changed: 33 additions & 17 deletions

File tree

pecan/Frontend/pecan-live-dashboard/src/App.tsx

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,24 @@ import Sidebar from "./components/Sidebar";
44
import Hamburger from "./components/HamburgerMenu";
55
import { Outlet } from "react-router";
66

7-
87
function App() {
98
const [isSidebarOpen, setIsSidebarOpen] = useState<boolean>(false);
109

1110
return (
12-
<>
13-
<div className="h-screen flex flex-row ">
14-
<div className="h-screen w-[60px]">
15-
<Hamburger trigger={() => setIsSidebarOpen(true)} />
16-
<Sidebar isOpen={isSidebarOpen} onClose={() => setIsSidebarOpen(false)} />
17-
</div>
18-
19-
{/* Main content area, Outlet element is needed to display the rendered child pages received from the routes */}
20-
<main id="main-content" className=" w-100 h-full p-4">
21-
<Outlet />
22-
</main>
11+
<div className="h-screen flex flex-row ">
12+
<div className="h-screen w-[60px]">
13+
<Hamburger trigger={() => setIsSidebarOpen(true)} />
14+
<Sidebar
15+
isOpen={isSidebarOpen}
16+
onClose={() => setIsSidebarOpen(false)}
17+
/>
2318
</div>
24-
25-
</>
19+
20+
{/* Main content area, Outlet element is needed to display the rendered child pages received from the routes */}
21+
<main id="main-content" className=" w-100 h-full p-4">
22+
<Outlet />
23+
</main>
24+
</div>
2625
);
2726
}
2827

pecan/Frontend/pecan-live-dashboard/src/components/Sidebar.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function Sidebar({ isOpen, onClose }: Readonly<InputProps>) {
3434
<NavLink onClick={onClose} to={"/"}>
3535
<img className="my-10 cursor-pointer" src={banner} alt="banner" />
3636
</NavLink>
37-
{/* Could create a global function to close the sidebar and use it in the component rather than passing it in every time */}
37+
{/* Could create a global function to close the sidebar and use it in the component rather than passing onClose in every time */}
3838
<ul className="p-0">
3939
<SidebarOption
4040
option="Dashboard"
@@ -46,12 +46,17 @@ function Sidebar({ isOpen, onClose }: Readonly<InputProps>) {
4646
path="/accumulator"
4747
onClose={onClose}
4848
/>
49+
<SidebarOption
50+
option="Chargecart"
51+
path="/chargecart"
52+
onClose={onClose}
53+
/>
4954
</ul>
5055
</div>
5156
<footer className="font-footer flex flex-col space-y-8 mb-10">
5257
{/* Should go to /account*/}
5358
<NavLink
54-
to={"/"}
59+
to={"/account"}
5560
className="!no-underline text-md flex flex-row space-x-6 ml-4"
5661
onClick={onClose}
5762
>
@@ -60,7 +65,7 @@ function Sidebar({ isOpen, onClose }: Readonly<InputProps>) {
6065
</NavLink>
6166
{/* Should go to /settings*/}
6267
<NavLink
63-
to={"/"}
68+
to={"/settings"}
6469
className="!no-underline flex flex-row space-x-6 text-md ml-4"
6570
onClick={onClose}
6671
>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function ChargeCart() {
2+
return <div></div>;
3+
}
4+
5+
export default ChargeCart;

pecan/Frontend/pecan-live-dashboard/src/routes.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,21 @@ import { createBrowserRouter } from "react-router";
22
import App from "./App";
33
import Dashboard from "./pages/Dashboard";
44
import Accumulator from "./pages/Accumulator";
5+
import Account from "./pages/Account";
6+
import Settings from "./pages/Settings";
7+
import ChargeCart from "./pages/ChargeCart";
58

69
export const router = createBrowserRouter([
710
{
811
path: "/",
912
element: <App />,
13+
//Pages are separate components, to add a route that is related to '/' just add a child, path is the relative path
1014
children: [
1115
{ path: "dashboard", element: <Dashboard /> },
1216
{ path: "accumulator", element: <Accumulator /> },
17+
{ path: "account", element: <Account /> },
18+
{ path: "settings", element: <Settings /> },
19+
{ path: "chargecart", element: <ChargeCart /> },
1320
],
1421
},
1522
]);

0 commit comments

Comments
 (0)