51 lines
2.6 KiB
TypeScript
51 lines
2.6 KiB
TypeScript
import { type TargetedEvent } from "preact/compat"
|
|
import { useAuth } from "./EspaceMembres";
|
|
|
|
export default function Login() {
|
|
const { login } = useAuth();
|
|
|
|
const handleSubmit = (event: TargetedEvent<HTMLFormElement>) => {
|
|
event.preventDefault()
|
|
login(event.currentTarget.email.value, event.currentTarget.password.value)
|
|
}
|
|
|
|
return (
|
|
<div className="flex min-h-full flex-col justify-center px-6 py-12 lg:px-8">
|
|
<div className="sm:mx-auto sm:w-full sm:max-w-sm">
|
|
<h2 className="mt-10 text-center text-2xl font-bold leading-9 tracking-tight text-gray-900">Connectez-vous à votre compte</h2>
|
|
</div>
|
|
|
|
<div className="mt-10 sm:mx-auto sm:w-full sm:max-w-sm">
|
|
<form className="space-y-6" onSubmit={handleSubmit}>
|
|
<div>
|
|
<label for="email" className="block text-sm font-medium leading-6 text-gray-900">Adresse e-mail</label>
|
|
<div className="mt-2">
|
|
<input id="email" name="email" type="email" autocomplete="email" required className="block w-full rounded-sm border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-gray-600 sm:text-sm sm:leading-6" />
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<div className="flex items-center justify-between">
|
|
<label for="password" className="block text-sm font-medium leading-6 text-gray-900">Mot de passe</label>
|
|
<div className="text-sm">
|
|
<a href="#" className="font-semibold text-gray-600 hover:text-gray-500">Mot de passe oublié ?</a>
|
|
</div>
|
|
</div>
|
|
<div className="mt-2">
|
|
<input id="password" name="password" type="password" autocomplete="current-password" required className="block w-full rounded-sm border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-gray-600 sm:text-sm sm:leading-6" />
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<button type="submit" className="flex w-full justify-center rounded-sm bg-gray-600 px-3 py-1.5 text-sm font-semibold leading-6 text-white shadow-sm hover:bg-gray-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-600">Connexion</button>
|
|
</div>
|
|
</form>
|
|
|
|
<p className="mt-10 text-center text-sm text-gray-500">
|
|
Pas encore de compte ? <a href="#" className="font-semibold leading-6 text-gray-600 hover:text-gray-500">Inscrivez-vous</a>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|