From c881d6494a8d892b7c89a60dd6cda10fb8c087d6 Mon Sep 17 00:00:00 2001 From: Arindam <17arindambera@gmail.com> Date: Wed, 9 Oct 2024 02:43:30 +0530 Subject: [PATCH 1/2] logout modal pop added --- frontend/src/components/Shared/Navbar.jsx | 57 +++++++++++++++++------ 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/frontend/src/components/Shared/Navbar.jsx b/frontend/src/components/Shared/Navbar.jsx index 6864af6b..524cabdb 100644 --- a/frontend/src/components/Shared/Navbar.jsx +++ b/frontend/src/components/Shared/Navbar.jsx @@ -1,9 +1,10 @@ -import { useState, useEffect, useRef } from "react"; +import { useState, useEffect } from "react"; import Logo from "../../assets/Logo/playcafe.png"; import { Link, useLocation } from "react-router-dom"; const Navbar = () => { const [isloggedIn, setisloggedIn] = useState(false); + const [isModalOpen, setIsModalOpen] = useState(false); const [isScrolled, setIsScrolled] = useState(false); const [isMenuOpen, setIsMenuOpen] = useState(false); const location = useLocation(); @@ -24,8 +25,6 @@ const Navbar = () => { window.addEventListener("scroll", handleScroll); - - return () => { window.removeEventListener("scroll", handleScroll); }; @@ -35,6 +34,11 @@ const Navbar = () => { setIsMenuOpen(!isMenuOpen); }; + const handleLogout = () => { + setisloggedIn(false); // Set isLoggedIn to false on confirmation + setIsModalOpen(false); // Close the modal + }; + const isHomePage = location.pathname === "/"; let buttonTextClass; if (isScrolled) { @@ -51,9 +55,8 @@ const Navbar = () => { return (