From 743c00780609f4f259d5af0d35deafaef6729de2 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 25 Feb 2024 00:18:20 +0800 Subject: [PATCH] :bug: Bug fixes --- components/NavigationDrawer.tsx | 80 ++++++++++++++++----------------- 1 file changed, 39 insertions(+), 41 deletions(-) diff --git a/components/NavigationDrawer.tsx b/components/NavigationDrawer.tsx index 80187c4..6f220f0 100644 --- a/components/NavigationDrawer.tsx +++ b/components/NavigationDrawer.tsx @@ -19,10 +19,10 @@ import { Fragment, ReactNode, useState } from "react"; import HomeIcon from "@mui/icons-material/Home"; import ArticleIcon from "@mui/icons-material/Article"; import FeedIcon from "@mui/icons-material/RssFeed"; -import InfoIcon from '@mui/icons-material/Info'; -import GavelIcon from '@mui/icons-material/Gavel'; -import PolicyIcon from '@mui/icons-material/Policy'; -import SupervisedUserCircleIcon from '@mui/icons-material/SupervisedUserCircle'; +import InfoIcon from "@mui/icons-material/Info"; +import GavelIcon from "@mui/icons-material/Gavel"; +import PolicyIcon from "@mui/icons-material/Policy"; +import SupervisedUserCircleIcon from "@mui/icons-material/SupervisedUserCircle"; import ExpandLess from "@mui/icons-material/ExpandLess"; import ExpandMore from "@mui/icons-material/ExpandMore"; import Link from "next/link"; @@ -59,6 +59,40 @@ export const AppNavigationHeader = styled("div")(({ theme }) => ({ ...theme.mixins.toolbar })); +export function AppNavigationSection({ items, depth }: { items: NavigationItem[], depth?: number }) { + const [open, setOpen] = useState(false); + + return items.map((item, idx) => { + if (item.divider) { + return ; + } else if (item.children) { + return ( + + setOpen(!open)} sx={{ pl: 2 + (depth ?? 0) * 2 }}> + {item.icon} + + {open ? : } + + + + + + + + ); + } else { + return ( + + + {item.icon} + + + + ); + } + }); +} + export function AppNavigation({ showClose, onClose }: { showClose?: boolean; onClose: () => void }) { return ( <> @@ -71,43 +105,7 @@ export function AppNavigation({ showClose, onClose }: { showClose?: boolean; onC - {NAVIGATION_ITEMS.map((item, idx) => { - if (item.divider) { - return ; - } else if (item.children) { - const [open, setOpen] = useState(false); - return ( - - setOpen(!open)}> - {item.icon} - - {open ? : } - - - - {item.children.map((item, idx) => item.divider ? ( - - ) : ( - - - {item.icon} - - - - ))} - - - - ); - } else { - return - - {item.icon} - - - ; - } - })} + );