From 2b2c872ddbe6a5a6fdbc6cbe3093c84496c3364c Mon Sep 17 00:00:00 2001 From: Mitchell Magro Date: Fri, 20 Jun 2025 08:05:52 +0200 Subject: [PATCH] Changed Page Routing and added header --- app/components/dashboard/header/Header.tsx | 46 ++++++++++++ .../dashboard/layout/layoutWrapper.ts | 8 ++ .../dashboard/layout/mainContent.ts | 8 ++ .../{ => dashboard}/sidebar/SideBarLink.tsx | 0 app/components/dashboard/sidebar/Sidebar.tsx | 55 ++++++++++++++ app/components/sidebar/Sidebar.tsx | 73 ------------------- app/dashboard/layout.tsx | 17 ++++- app/dashboard/page.tsx | 2 +- app/page.tsx | 5 -- 9 files changed, 133 insertions(+), 81 deletions(-) create mode 100644 app/components/dashboard/header/Header.tsx create mode 100644 app/components/dashboard/layout/layoutWrapper.ts create mode 100644 app/components/dashboard/layout/mainContent.ts rename app/components/{ => dashboard}/sidebar/SideBarLink.tsx (100%) create mode 100644 app/components/dashboard/sidebar/Sidebar.tsx delete mode 100644 app/components/sidebar/Sidebar.tsx delete mode 100644 app/page.tsx diff --git a/app/components/dashboard/header/Header.tsx b/app/components/dashboard/header/Header.tsx new file mode 100644 index 0000000..be106f6 --- /dev/null +++ b/app/components/dashboard/header/Header.tsx @@ -0,0 +1,46 @@ +import React, { useState } from 'react'; +import { AppBar, Toolbar, IconButton, Menu, MenuItem, Button } from '@mui/material'; +import MenuIcon from '@mui/icons-material/Menu'; + +const Header = () => { + const [anchorEl, setAnchorEl] = useState(null); + + // Handle menu open + const handleMenuClick = (event: React.MouseEvent) => { + setAnchorEl(event.currentTarget); + }; + + // Handle menu close + const handleMenuClose = () => { + setAnchorEl(null); + }; + + return ( + + + {/* Burger Menu */} + + + + + {/* Dropdown Button */} + + + {/* Dropdown Menu */} + + Option 1 + Option 2 + Option 3 + + + + ); +}; + +export default Header; diff --git a/app/components/dashboard/layout/layoutWrapper.ts b/app/components/dashboard/layout/layoutWrapper.ts new file mode 100644 index 0000000..7da683a --- /dev/null +++ b/app/components/dashboard/layout/layoutWrapper.ts @@ -0,0 +1,8 @@ +import { styled } from '@mui/system'; + +export const LayoutWrapper = styled('div')({ + display: 'flex', + width: '100%', + height: '100vh', + overflow: 'hidden', +}); \ No newline at end of file diff --git a/app/components/dashboard/layout/mainContent.ts b/app/components/dashboard/layout/mainContent.ts new file mode 100644 index 0000000..39b1395 --- /dev/null +++ b/app/components/dashboard/layout/mainContent.ts @@ -0,0 +1,8 @@ +import { styled } from '@mui/system'; + +export const MainContent = styled('div')(({ theme }) => ({ + marginLeft: '240px', + padding: theme.spacing(3), + minHeight: '100vh', + width: 'calc(100% - 240px)', +})); \ No newline at end of file diff --git a/app/components/sidebar/SideBarLink.tsx b/app/components/dashboard/sidebar/SideBarLink.tsx similarity index 100% rename from app/components/sidebar/SideBarLink.tsx rename to app/components/dashboard/sidebar/SideBarLink.tsx diff --git a/app/components/dashboard/sidebar/Sidebar.tsx b/app/components/dashboard/sidebar/Sidebar.tsx new file mode 100644 index 0000000..527f341 --- /dev/null +++ b/app/components/dashboard/sidebar/Sidebar.tsx @@ -0,0 +1,55 @@ +'use client'; + +import React from 'react'; +import DashboardIcon from '@mui/icons-material/Dashboard'; +import { styled } from '@mui/system'; +import { SIDEBAR_LINKS } from '@/constants/SidebarLink.constants'; +import SidebarLink from './SideBarLink'; + +const SidebarContainer = styled('aside')(({ theme }) => ({ + position: 'fixed', + top: 0, + left: 0, + width: 240, + height: '100vh', + backgroundColor: theme.palette.background.primary, + color: theme.palette.text.primary, + display: 'flex', + flexDirection: 'column', + padding: theme.spacing(2), + zIndex: 1100, + borderRight: `1px solid ${theme.palette.divider}`, +})); + +const SidebarHeader = styled('div')(({ theme }) => ({ + fontSize: '20px', + fontWeight: 600, + marginBottom: theme.spacing(3), + display: 'flex', + alignItems: 'center', + color: theme.palette.text.primary, +})); + +const IconSpacing = styled(DashboardIcon)(({ theme }) => ({ + marginLeft: theme.spacing(1), +})); + +const Sidebar = () => { + return ( + + + PaymentIQ + + {SIDEBAR_LINKS.map((link) => ( + + ))} + + ); +}; + +export default Sidebar; diff --git a/app/components/sidebar/Sidebar.tsx b/app/components/sidebar/Sidebar.tsx deleted file mode 100644 index cff7d8e..0000000 --- a/app/components/sidebar/Sidebar.tsx +++ /dev/null @@ -1,73 +0,0 @@ -'use client'; - -import React from 'react'; -import { styled } from '@mui/system'; -import DashboardIcon from '@mui/icons-material/Dashboard'; -import { SIDEBAR_LINKS } from '@/constants/SidebarLink.constants'; -import SidebarLink from './SideBarLink'; - -// Sidebar Container (styled using MUI System) -export const Sidebar = styled('div')(({ theme }) => ({ - width: '240px', - backgroundColor: theme.palette.background.primary, - color: 'white', - padding: theme.spacing(2), - height: '100vh', - display: 'flex', - flexDirection: 'column', - justifyContent: 'space-between', - transition: 'width 0.3s ease', // Transition for resizing -})); - -// Main Content Area -export const MainContent = styled('div')(({ theme }) => ({ - flexGrow: 1, - padding: theme.spacing(4), - backgroundColor: theme.palette.background.default, - minHeight: '100vh', - overflowY: 'auto', -})); - -// Sidebar Header -export const SidebarHeader = styled('div')(({ theme }) => ({ - marginBottom: theme.spacing(2), - fontSize: '20px', - fontWeight: 600, - display: 'flex', - alignItems: 'center', -})); - -// Page Wrapper that holds Sidebar and Content -export const LayoutWrapper = styled('div')({ - display: 'flex', - flexDirection: 'row', - height: '100vh', -}); - -interface SidebarLayoutProps { - children: React.ReactNode; // Add children to accept passed content -} - -const SidebarLayout: React.FC = ({ children }) => { - return ( - - - - PaymentIQ - - - {SIDEBAR_LINKS.map((link) => ( - - ))} - - {children} {/* Render children here */} - - ); -}; - -export default SidebarLayout; diff --git a/app/dashboard/layout.tsx b/app/dashboard/layout.tsx index e9aefe5..77a0a24 100644 --- a/app/dashboard/layout.tsx +++ b/app/dashboard/layout.tsx @@ -1,10 +1,23 @@ 'use client'; import React from 'react'; -import SidebarLayout from '../components/sidebar/Sidebar'; +import { MainContent } from '../components/dashboard/layout/mainContent'; +import Header from '../components/dashboard/header/Header'; +import { LayoutWrapper } from '../components/dashboard/layout/layoutWrapper'; +import Sidebar from '@/app/components/dashboard/sidebar/Sidebar'; const DashboardLayout: React.FC<{ children: React.ReactNode }> = ({ children }) => { - return {children}; // Ensure that the sidebar wraps all dashboard pages + return ( + + +
+ +
+ {children} + +
+
+ ); }; export default DashboardLayout; diff --git a/app/dashboard/page.tsx b/app/dashboard/page.tsx index 4520b57..31b5ea4 100644 --- a/app/dashboard/page.tsx +++ b/app/dashboard/page.tsx @@ -1,7 +1,7 @@ 'use client'; import React from 'react'; -import { Typography, Paper } from '@mui/material'; +import { Typography } from '@mui/material'; const DashboardPage = () => { return ( diff --git a/app/page.tsx b/app/page.tsx deleted file mode 100644 index 3915b26..0000000 --- a/app/page.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import SidebarLayout from '@/app/components/sidebar/Sidebar'; - -export default function Home() { - return ; -}