Files
dashboard/components/auth/ForgotPasswordForm.tsx
Alberto-Audrix 32a36cceff
CI / lint-and-test (push) Canceled after 0s
first commit
2026-07-28 08:55:05 +07:00

95 lines
3.0 KiB
TypeScript

import React, { useState } from 'react';
import { CheckIcon } from '../icons/Icons';
interface ForgotPasswordFormProps {
onBackToLogin: () => void;
}
const ForgotPasswordForm: React.FC<ForgotPasswordFormProps> = ({ onBackToLogin }) => {
const [email, setEmail] = useState('');
const [submitted, setSubmitted] = useState(false);
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
setSubmitted(true);
};
if (submitted) {
return (
<div className="text-center">
<div className="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-green-100">
<CheckIcon className="h-6 w-6 text-green-600" />
</div>
<h3 className="mt-3 text-lg leading-6 font-medium text-gray-900">Permintaan Terkirim</h3>
<div className="mt-2 px-7 text-sm text-gray-500">
<p>
Jika ada akun yang cocok dengan <strong>{email}</strong>, instruksi untuk mengatur ulang
kata sandi telah dikirim.
</p>
</div>
<div className="mt-4">
<button
type="button"
onClick={onBackToLogin}
className="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700"
>
Kembali ke Login
</button>
</div>
</div>
);
}
return (
<form onSubmit={handleSubmit} className="space-y-6">
<div>
<h3 className="text-lg leading-6 font-medium text-gray-900 text-center mb-1">
Lupa Kata Sandi?
</h3>
<p className="text-center text-sm text-gray-500">
Masukkan email Anda dan kami akan mengirimkan instruksi untuk reset.
</p>
</div>
<div>
<label htmlFor="email-forgot" className="block text-sm font-medium text-gray-700">
Alamat Email
</label>
<div className="mt-1">
<input
id="email-forgot"
name="email"
type="email"
autoComplete="email"
required
value={email}
onChange={(e) => setEmail(e.target.value)}
className="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-red-500 focus:border-red-500 sm:text-sm"
placeholder="anda@cp.co.id"
/>
</div>
</div>
<div>
<button
type="submit"
className="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-red-600 hover:bg-red-700"
>
Kirim Instruksi Reset
</button>
</div>
<div className="text-sm text-center">
<button
type="button"
onClick={onBackToLogin}
className="font-medium text-gray-600 hover:text-gray-500"
>
Kembali ke Login
</button>
</div>
</form>
);
};
export default ForgotPasswordForm;