From bac71c7f02738a360543652382228f18d1d3ce79 Mon Sep 17 00:00:00 2001 From: Eric Wang <37554696+ericwang401@users.noreply.github.com> Date: Sun, 12 Nov 2023 01:42:08 +0000 Subject: [PATCH] close mobile navigation menu on navigate --- .../elements/navigation/NavigationBar.tsx | 10 ++++++++-- .../elements/navigation/NavigationDropdown.tsx | 16 ++++++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/resources/scripts/components/elements/navigation/NavigationBar.tsx b/resources/scripts/components/elements/navigation/NavigationBar.tsx index cdfe734a9e6..0552bb0c132 100644 --- a/resources/scripts/components/elements/navigation/NavigationBar.tsx +++ b/resources/scripts/components/elements/navigation/NavigationBar.tsx @@ -141,11 +141,17 @@ const NavigationBar = () => { setMenuVisible(!menuVisible)} + onClick={() => + setMenuVisible(visibility => !visibility) + } /> - + setMenuVisible(false)} + logout={logout} + visible={menuVisible} + />
void to: string } -const NavLink = ({ children, to }: LinkProps) => { +const NavLink = ({ children, onClick, to }: LinkProps) => { return ( {children} @@ -20,11 +23,12 @@ const NavLink = ({ children, to }: LinkProps) => { interface Props { logout: () => void + onClose: () => void visible?: boolean } -const NavigationDropdown = ({ logout, visible }: Props) => { - const navigate = useNavigate() +const NavigationDropdown = ({ logout, onClose, visible }: Props) => { + const user = useStoreState(state => state.user.data) const isAdminArea = useMatch('/admin/*') useEffect(() => { @@ -45,7 +49,11 @@ const NavigationDropdown = ({ logout, visible }: Props) => { >
- Admin Center + {user?.rootAdmin ? ( + + Admin Center + + ) : null}