add Meteo part
This commit is contained in:
@@ -1,24 +1,25 @@
|
||||
import React from "react"
|
||||
import {Link} from "react-router-dom"
|
||||
import {Link, useLocation} from "react-router-dom"
|
||||
import useAuthUser from "../hooks/AuthUser"
|
||||
|
||||
const Header = () => {
|
||||
|
||||
const {authUser, logout} = useAuthUser()
|
||||
const {authUser} = useAuthUser()
|
||||
const location = useLocation()
|
||||
|
||||
return <header className="flex justify-between py-3 px-5 bg-blue-700 text-white text-xl">
|
||||
<div>
|
||||
<Link to="/">Bermite</Link>
|
||||
</div>
|
||||
|
||||
{/*{authUser && <nav className="flex gap-2">*/}
|
||||
{/* <Link to="/pluviometrie">Pluviométrie</Link>*/}
|
||||
{/* <Link to="/meteo">Météo</Link>*/}
|
||||
{/*</nav>}*/}
|
||||
{authUser?.locations && authUser.locations.length > 0 && <nav className="flex gap-2">
|
||||
<Link to="/pluviometrie" className={location.pathname === '/pluviometrie' ? 'font-bold' : ''}>Pluviométrie</Link>
|
||||
<Link to="/meteo" className={location.pathname === '/meteo' ? 'font-bold' : ''}>Météo</Link>
|
||||
</nav>}
|
||||
|
||||
{authUser
|
||||
? <span className="flex gap-2">
|
||||
<Link to="/profile">{authUser.name}</Link>
|
||||
<Link to="/profile" className={location.pathname === '/profile' ? 'font-bold' : ''}>{authUser.name}</Link>
|
||||
</span>
|
||||
: <span className="flex gap-2">
|
||||
<Link to="/connexion">Connexion</Link>
|
||||
|
||||
Reference in New Issue
Block a user