Added Maincontent and Routing while sidebar is fixed
This commit is contained in:
parent
bd11919a98
commit
f45df1eeae
@ -1,4 +1,4 @@
|
|||||||
'use client'
|
'use client';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { styled } from '@mui/system';
|
import { styled } from '@mui/system';
|
||||||
@ -16,23 +16,25 @@ export const Sidebar = styled('div')(({ theme }) => ({
|
|||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
|
transition: 'width 0.3s ease', // Transition for resizing
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Main Content Area
|
// Main Content Area
|
||||||
export const MainContent = styled('div')(({ theme }) => ({
|
export const MainContent = styled('div')(({ theme }) => ({
|
||||||
marginLeft: '240px',
|
flexGrow: 1,
|
||||||
padding: theme.spacing(3),
|
padding: theme.spacing(4),
|
||||||
backgroundColor: theme.palette.secondary.main,
|
backgroundColor: theme.palette.background.default,
|
||||||
minHeight: '100vh',
|
minHeight: '100vh',
|
||||||
|
overflowY: 'auto',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Sidebar Navigation Items
|
// Sidebar Header
|
||||||
export const SidebarItem = styled('div')(({ theme }) => ({
|
export const SidebarHeader = styled('div')(({ theme }) => ({
|
||||||
padding: theme.spacing(1.5),
|
marginBottom: theme.spacing(2),
|
||||||
cursor: 'pointer',
|
fontSize: '20px',
|
||||||
'&:hover': {
|
fontWeight: 600,
|
||||||
backgroundColor: 'brown',
|
display: 'flex',
|
||||||
},
|
alignItems: 'center',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Page Wrapper that holds Sidebar and Content
|
// Page Wrapper that holds Sidebar and Content
|
||||||
@ -42,18 +44,18 @@ export const LayoutWrapper = styled('div')({
|
|||||||
height: '100vh',
|
height: '100vh',
|
||||||
});
|
});
|
||||||
|
|
||||||
// Sidebar Header
|
interface SidebarLayoutProps {
|
||||||
export const SidebarHeader = styled('div')(({ theme }) => ({
|
children: React.ReactNode; // Add children to accept passed content
|
||||||
marginBottom: theme.spacing(2),
|
}
|
||||||
fontSize: '20px',
|
|
||||||
fontWeight: 600,
|
|
||||||
}));
|
|
||||||
|
|
||||||
const SidebarLayout = () => {
|
const SidebarLayout: React.FC<SidebarLayoutProps> = ({ children }) => {
|
||||||
return (
|
return (
|
||||||
<LayoutWrapper>
|
<LayoutWrapper>
|
||||||
<Sidebar>
|
<Sidebar>
|
||||||
<SidebarHeader>PaymentIQ<DashboardIcon sx={{ marginLeft: 0.5 }}/></SidebarHeader>
|
<SidebarHeader>
|
||||||
|
PaymentIQ
|
||||||
|
<DashboardIcon sx={{ marginLeft: 0.5 }} />
|
||||||
|
</SidebarHeader>
|
||||||
{SIDEBAR_LINKS.map((link) => (
|
{SIDEBAR_LINKS.map((link) => (
|
||||||
<SidebarLink
|
<SidebarLink
|
||||||
key={link.path}
|
key={link.path}
|
||||||
@ -63,8 +65,9 @@ const SidebarLayout = () => {
|
|||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Sidebar>
|
</Sidebar>
|
||||||
|
<MainContent>{children}</MainContent> {/* Render children here */}
|
||||||
</LayoutWrapper>
|
</LayoutWrapper>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default SidebarLayout;
|
export default SidebarLayout;
|
||||||
|
|||||||
13
app/dashboard/approve/page.tsx
Normal file
13
app/dashboard/approve/page.tsx
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// This ensures this component is rendered only on the client side
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
export default function ApprovePage() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{/* This page will now be rendered on the client-side */}
|
||||||
|
<h1>Approve</h1>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
13
app/dashboard/investigate/page.tsx
Normal file
13
app/dashboard/investigate/page.tsx
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// This ensures this component is rendered only on the client side
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
export default function InvestigatePage() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{/* This page will now be rendered on the client-side */}
|
||||||
|
<h1>Investigate</h1>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
10
app/dashboard/layout.tsx
Normal file
10
app/dashboard/layout.tsx
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import SidebarLayout from '../components/sidebar/Sidebar';
|
||||||
|
|
||||||
|
const DashboardLayout: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
||||||
|
return <SidebarLayout>{children}</SidebarLayout>; // Ensure that the sidebar wraps all dashboard pages
|
||||||
|
};
|
||||||
|
|
||||||
|
export default DashboardLayout;
|
||||||
17
app/dashboard/page.tsx
Normal file
17
app/dashboard/page.tsx
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import { Typography, Paper } from '@mui/material';
|
||||||
|
|
||||||
|
const DashboardPage = () => {
|
||||||
|
return (
|
||||||
|
<div style={{ width: '100vh' }}>
|
||||||
|
<Typography variant="h4" gutterBottom>
|
||||||
|
Dashboard Overview
|
||||||
|
</Typography>
|
||||||
|
{/* Add your dashboard content here */}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default DashboardPage;
|
||||||
13
app/dashboard/transactions/page.tsx
Normal file
13
app/dashboard/transactions/page.tsx
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// This ensures this component is rendered only on the client side
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
export default function TransactionPage() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{/* This page will now be rendered on the client-side */}
|
||||||
|
<h1>Transactions</h1>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -1,4 +1,3 @@
|
|||||||
import Image from "next/image";
|
|
||||||
import SidebarLayout from '@/app/components/sidebar/Sidebar';
|
import SidebarLayout from '@/app/components/sidebar/Sidebar';
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
|
|||||||
@ -16,9 +16,9 @@ import { ISidebarLink } from '@/interfaces/SidebarLink.interfaces';
|
|||||||
|
|
||||||
|
|
||||||
export const SIDEBAR_LINKS: ISidebarLink[] = [
|
export const SIDEBAR_LINKS: ISidebarLink[] = [
|
||||||
{ title: 'Home', path: '/', icon: HomeIcon },
|
{ title: 'Home', path: '/dashboard', icon: HomeIcon },
|
||||||
{ title: 'Transaction', path: '/transaction', icon: AccountBalanceWalletIcon },
|
{ title: 'Transaction', path: '/dashboard/transactions', icon: AccountBalanceWalletIcon },
|
||||||
{ title: 'Approve', path: '/approve', icon: CheckCircleIcon },
|
{ title: 'Approve', path: '/dashboard/approve', icon: CheckCircleIcon },
|
||||||
{ title: 'Investigate', path: '/investigate', icon: SearchIcon },
|
{ title: 'Investigate', path: '/investigate', icon: SearchIcon },
|
||||||
{ title: 'KYC', path: '/kyc', icon: VerifiedUserIcon },
|
{ title: 'KYC', path: '/kyc', icon: VerifiedUserIcon },
|
||||||
{ title: 'User Accounts', path: '/user-accounts', icon: PeopleIcon },
|
{ title: 'User Accounts', path: '/user-accounts', icon: PeopleIcon },
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user