add Meteo part

This commit is contained in:
Romulus21
2023-09-24 11:19:58 +02:00
parent bfaf82f264
commit 33b2044859
23 changed files with 429 additions and 31 deletions

View File

@@ -3,14 +3,14 @@ import React, {
ReactElement
} from "react"
const Field: FC<FieldProps> = ({children, type = 'text', ...props}) => {
const Field: FC<FieldProps> = ({children, type = 'text', className = '', ...props}) => {
return <div className="form-control">
{children && <label className="block text-gray-900 dark:text-gray-200"
htmlFor={props.id ?? undefined}>
{children}
</label>}
<input className="w-full mt-2 rounded dark:bg-gray-700"
<input className={`${className} w-full mt-2 rounded dark:bg-gray-700`}
type={type}
{...props}/>
<div className={`error-message`} />
@@ -27,5 +27,7 @@ interface FieldProps {
value: any,
placeholder?: string,
autoFocus?: boolean,
className?: string,
step?: string,
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void,
}

View File

@@ -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>