37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import React from "react"
|
|
import {Link, NavLink, useLocation} from "react-router-dom"
|
|
import useAuthUser from "../hooks/AuthUser";
|
|
import Tracker from "./TimeTrackers/Tracker";
|
|
|
|
const Header = () => {
|
|
|
|
const {authUser} = useAuthUser()
|
|
const location = useLocation()
|
|
|
|
console.log(authUser)
|
|
|
|
return <header className="bg-blue-700 text-white text-xl">
|
|
<div className="flex py-3 px-5 justify-between">
|
|
<div>
|
|
<Link to="/">Ticcat</Link>
|
|
</div>
|
|
|
|
{authUser && <Tracker />}
|
|
{authUser
|
|
? <span className="flex gap-2">
|
|
<Link to="/profile" className={location.pathname === '/profile' ? 'font-bold' : ''}>{authUser.name}</Link>
|
|
</span>
|
|
: <span className="flex gap-2">
|
|
<Link to="/connexion">Connexion</Link>
|
|
{/*<Link to="/sinscrire">S'inscrire</Link>*/}
|
|
</span>}
|
|
</div>
|
|
<nav className="bg-gray-600 px-5 flex gap-5">
|
|
<NavLink to="/">ToDos</NavLink>
|
|
<NavLink to="/times">Times</NavLink>
|
|
</nav>
|
|
</header>
|
|
}
|
|
|
|
export default Header
|