73 lines
3.3 KiB
TypeScript
73 lines
3.3 KiB
TypeScript
import React from 'react';
|
|
import GuestLayout from '@/Layouts/GuestLayout';
|
|
import { Head, useForm, Link } from '@inertiajs/react';
|
|
|
|
export default function ForgotPassword({ status }: { status?: string }) {
|
|
const { data, setData, post, processing, errors } = useForm({ email: '' });
|
|
|
|
const submit = (e: React.FormEvent) => {
|
|
e.preventDefault();
|
|
post(route('password.email'));
|
|
};
|
|
|
|
return (
|
|
<GuestLayout>
|
|
<Head title="Forgot password" />
|
|
|
|
<div className="mb-8 anim-down">
|
|
<h1 className="text-2xl font-bold text-[#1A2421] tracking-tight">Forgot password?</h1>
|
|
<p className="mt-1.5 text-sm text-gray-400 font-medium">
|
|
Enter your email and we'll send a reset link.
|
|
</p>
|
|
</div>
|
|
|
|
{status && (
|
|
<div className="mb-6 px-4 py-3 rounded-xl bg-emerald-50 border border-emerald-100 text-sm font-semibold text-emerald-700 anim-fade">
|
|
{status}
|
|
</div>
|
|
)}
|
|
|
|
<form onSubmit={submit} className="anim-up" style={{ animationDelay: '0.1s' }}>
|
|
<div>
|
|
<label htmlFor="email" className="block text-sm font-semibold text-gray-600 mb-1.5">
|
|
Email address
|
|
</label>
|
|
<input
|
|
id="email"
|
|
type="email"
|
|
autoComplete="email"
|
|
autoFocus
|
|
value={data.email}
|
|
onChange={e => setData('email', e.target.value)}
|
|
placeholder="you@company.com"
|
|
className={`auth-input${errors.email ? ' !border-red-300 !bg-red-50/50' : ''}`}
|
|
/>
|
|
{errors.email && <p className="mt-1.5 text-xs font-semibold text-red-500">{errors.email}</p>}
|
|
</div>
|
|
|
|
<button
|
|
type="submit"
|
|
disabled={processing}
|
|
className="mt-6 w-full h-11 rounded-xl bg-[#3D4E4B] hover:bg-[#2D3A38] text-white text-sm font-bold tracking-tight transition-colors duration-200 flex items-center justify-center gap-2 disabled:opacity-60 disabled:cursor-not-allowed"
|
|
>
|
|
{processing ? (
|
|
<>
|
|
<svg className="w-4 h-4 animate-spin text-white/60" fill="none" viewBox="0 0 24 24">
|
|
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" />
|
|
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" />
|
|
</svg>
|
|
Sending…
|
|
</>
|
|
) : 'Send reset link'}
|
|
</button>
|
|
</form>
|
|
|
|
<p className="mt-7 text-center text-sm text-gray-400 font-medium anim-fade" style={{ animationDelay: '0.18s' }}>
|
|
<Link href={route('login')} className="text-[#3D4E4B] font-semibold hover:text-[#D4A017] transition-colors duration-200">
|
|
← Back to sign in
|
|
</Link>
|
|
</p>
|
|
</GuestLayout>
|
|
);
|
|
}
|