-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Refactor sidebar into multiple components
- Loading branch information
1 parent
7af38b9
commit 7c1f07c
Showing
9 changed files
with
347 additions
and
177 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
src/app/dashboard/admin/programs/diabetes-prevention/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Box, Typography } from "@mui/material"; | ||
|
||
export default function DiabetesPreventionProgramPage() { | ||
return ( | ||
<Box | ||
sx={{ | ||
height: "100vh", | ||
display: "flex", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
}} | ||
> | ||
<Typography>Diabetes Prevention Program</Typography> | ||
</Box> | ||
); | ||
} |
16 changes: 16 additions & 0 deletions
16
src/app/dashboard/admin/programs/get-preventative-screenings/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Box, Typography } from "@mui/material"; | ||
|
||
export default function GetPreventativeScreeningsProgramPage() { | ||
return ( | ||
<Box | ||
sx={{ | ||
height: "100vh", | ||
display: "flex", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
}} | ||
> | ||
<Typography>Get Preventative Screenings Program</Typography> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Box, Typography } from "@mui/material"; | ||
|
||
export default function HealthyHabitsProgramPage() { | ||
return ( | ||
<Box | ||
sx={{ | ||
height: "100vh", | ||
display: "flex", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
}} | ||
> | ||
<Typography>Healthy Habits Program</Typography> | ||
</Box> | ||
); | ||
} |
16 changes: 16 additions & 0 deletions
16
src/app/dashboard/admin/programs/rigs-without-cigs/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Box, Typography } from "@mui/material"; | ||
|
||
export default function RigsWithoutCigsProgramPage() { | ||
return ( | ||
<Box | ||
sx={{ | ||
height: "100vh", | ||
display: "flex", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
}} | ||
> | ||
<Typography>Rigs Without Cigs Program</Typography> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Box, Typography } from "@mui/material"; | ||
|
||
export default function VaccineVoucherProgramPage() { | ||
return ( | ||
<Box | ||
sx={{ | ||
height: "100vh", | ||
display: "flex", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
}} | ||
> | ||
<Typography>Vaccine Voucher Program</Typography> | ||
</Box> | ||
); | ||
} |
58 changes: 58 additions & 0 deletions
58
src/components/AdminDashboard/Sidebar/CollapsibleSidebarButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
"use client"; | ||
|
||
import { ExpandLess, ExpandMore } from "@mui/icons-material"; | ||
import { | ||
ListItem, | ||
ListItemButton, | ||
ListItemIcon, | ||
ListItemText, | ||
Theme, | ||
} from "@mui/material"; | ||
import { ReactNode } from "react"; | ||
|
||
import getButtonStyles from "@/components/AdminDashboard/Sidebar/getButtonStyles"; | ||
|
||
type CollapsibleSidebarButtonProps = { | ||
pathname: string; | ||
theme: Theme; | ||
href: string; | ||
icon: ReactNode; | ||
label: string; | ||
onClick: () => void; | ||
open?: boolean; | ||
}; | ||
|
||
export default function CollapsibleSidebarButton({ | ||
pathname, | ||
theme, | ||
href, | ||
icon, | ||
label, | ||
onClick, | ||
open = false, | ||
}: CollapsibleSidebarButtonProps) { | ||
const { color, backgroundColor, hoverBackgroundColor } = getButtonStyles( | ||
theme, | ||
pathname, | ||
href, | ||
); | ||
|
||
return ( | ||
<ListItem disablePadding onClick={onClick}> | ||
<ListItemButton | ||
sx={{ | ||
backgroundColor: backgroundColor, | ||
"&:hover": { backgroundColor: hoverBackgroundColor }, | ||
}} | ||
> | ||
<ListItemIcon sx={{ color: color }}>{icon}</ListItemIcon> | ||
<ListItemText primary={label} sx={{ color: color }} /> | ||
{open ? ( | ||
<ExpandLess sx={{ color: color }} /> | ||
) : ( | ||
<ExpandMore sx={{ color: color }} /> | ||
)} | ||
</ListItemButton> | ||
</ListItem> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
"use client"; | ||
|
||
import { | ||
ListItem, | ||
ListItemButton, | ||
ListItemIcon, | ||
ListItemText, | ||
Theme, | ||
} from "@mui/material"; | ||
import Link from "next/link"; | ||
import { ReactNode } from "react"; | ||
|
||
import getButtonStyles from "@/components/AdminDashboard/Sidebar/getButtonStyles"; | ||
|
||
type SidebarButtonProps = { | ||
pathname: string; | ||
theme: Theme; | ||
href: string; | ||
icon: ReactNode; | ||
label: string; | ||
padLeft?: boolean; | ||
}; | ||
|
||
export default function SidebarButton({ | ||
pathname, | ||
theme, | ||
href, | ||
icon, | ||
label, | ||
padLeft, | ||
}: SidebarButtonProps) { | ||
const { color, backgroundColor, hoverBackgroundColor } = getButtonStyles( | ||
theme, | ||
pathname, | ||
href, | ||
); | ||
|
||
return ( | ||
<Link href={href} style={{ textDecoration: "none" }}> | ||
<ListItem disablePadding> | ||
<ListItemButton | ||
sx={{ | ||
backgroundColor: backgroundColor, | ||
"&:hover": { backgroundColor: hoverBackgroundColor }, | ||
paddingLeft: padLeft ? 4 : undefined, | ||
}} | ||
> | ||
<ListItemIcon sx={{ color: color }}>{icon}</ListItemIcon> | ||
<ListItemText primary={label} sx={{ color: color }} /> | ||
</ListItemButton> | ||
</ListItem> | ||
</Link> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Theme } from "@mui/material"; | ||
|
||
export default function getButtonStyles( | ||
theme: Theme, | ||
pathname: string, | ||
href: string, | ||
) { | ||
const isCurrentPage = pathname === href; | ||
|
||
return { | ||
backgroundColor: isCurrentPage ? theme.palette.primary.main : "inherit", | ||
hoverBackgroundColor: isCurrentPage | ||
? theme.palette.primary.light | ||
: "lightgray", | ||
color: isCurrentPage ? theme.palette.primary.contrastText : "black", | ||
}; | ||
} |
Oops, something went wrong.