From ea410a84d9799eac4d88e3989377ff7d8eb518f9 Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 23 May 2024 13:13:41 -0700 Subject: [PATCH] feat: adds functionality to keep user signed in while navigating pages --- frontend/src/components/NavbarSignedIn.tsx | 18 +++++++++++++----- frontend/src/pages/ItemsPage.tsx | 8 ++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/NavbarSignedIn.tsx b/frontend/src/components/NavbarSignedIn.tsx index bf2f4ab..a4b64bb 100644 --- a/frontend/src/components/NavbarSignedIn.tsx +++ b/frontend/src/components/NavbarSignedIn.tsx @@ -19,16 +19,15 @@ import { useNavigate, Link as ReactLink } from "react-router-dom"; const NavLink = ({ children, - href = "#", + handleClick, }: { children: ReactNode; - href?: string; + handleClick: () => void; }) => ( {children} @@ -59,6 +59,14 @@ const NavbarSignedIn = ({ stateVariable, updateState }: Props) => { navigate("/profile"); }; + const handleGroupsClick = () => { + navigate("/groups"); + } + + const handleItemsClick = () => { + navigate("/items"); + } + return ( { - My Items - My Groups + My Items + My Groups { + const navigate = useNavigate(); + + const handleGroupsClick = () => { + navigate("/groups"); + }; + return ( @@ -53,6 +60,7 @@ const ItemsPage: React.FC = () => {