import React, { useEffect, useState } from "react"; import { Link, useLocation, useNavigate } from "react-router-dom"; import { useAuth } from "../auth/auth.context"; import { UserIcon } from "../icons"; export const Header = () => { const { user, logout } = useAuth(); const location = useLocation(); const navigate = useNavigate(); const [windowSize, setWindowSize] = useState({ width: window.innerWidth, }); const [isClicked, setIsClicked] = useState(false); const handleHeaderClick = () => { setIsClicked(!isClicked); }; const handleResize = () => { setWindowSize({ width: window.innerWidth, }); }; useEffect(() => { window.addEventListener("resize", handleResize); return () => { window.removeEventListener("resize", handleResize); }; }, []); return (
Simple Survey Form
{user.isLoggedIn ? (
) : (
)}
) : (
) ) : ( <> )}
); };