74 lines
1.9 KiB
TypeScript
74 lines
1.9 KiB
TypeScript
'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<SideBarLayoutProps> = ({ children }) => {
|
|
return (
|
|
<LayoutWrapper>
|
|
<SideBar>
|
|
<SideBarHeader>
|
|
PaymentIQ
|
|
<DashboardIcon sx={{ marginLeft: 0.5 }} />
|
|
</SideBarHeader>
|
|
{SIDEBAR_LINKS.map((link) => (
|
|
<SideBarLink
|
|
key={link.path}
|
|
title={link.title}
|
|
path={link.path}
|
|
icon={link.icon}
|
|
/>
|
|
))}
|
|
</SideBar>
|
|
<MainContent>{children}</MainContent> {/* Render children here */}
|
|
</LayoutWrapper>
|
|
);
|
|
};
|
|
|
|
export default SideBarLayout;
|