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, height: window.innerHeight, }); const handleResize = () => { setWindowSize({ width: window.innerWidth, height: window.innerHeight, }); }; useEffect(() => { window.addEventListener("resize", handleResize); return () => { window.removeEventListener("resize", handleResize); }; }, []); return (
Simple Survey Form {windowSize.width < 768 ? ( ) : (
{user.isLoggedIn ? (
) : (
)}
)} {/*
Bonnie Green name@flowbite.com
*/}
); };