MIF_E31221222/sigap-website/components/auth/login-form-2.tsx

127 lines
4.0 KiB
TypeScript

"use client";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Github, Lock } from "lucide-react";
import Link from "next/link";
import { SubmitButton } from "../submit-button";
import { FormField } from "../form-field";
import { useSignInForm } from "@/src/infrastructure/hooks/use-signin";
export function LoginForm2({
className,
...props
}: React.ComponentPropsWithoutRef<"form">) {
const {
formData,
errors,
isSubmitting,
setFormData,
handleChange,
handleSelectChange,
handleSubmit,
} = useSignInForm();
return (
<div>
<div className="flex-1 flex items-center justify-center px-6">
<div className="w-full max-w-xl space-y-8">
<div className="flex flex-col gap-1">
<h1 className="text-3xl font-bold tracking-tight text-white">
Welcome back
</h1>
<p className="text-sm text-gray-400">Sign in to your account</p>
</div>
<div className="space-y-4">
{/* <Button
variant="outline"
className="w-full bg-[#1C1C1C] text-white border-gray-800 hover:bg-[#2C2C2C] hover:border-gray-700"
size="lg"
>
<Github className="mr-2 h-5 w-5" />
Continue with GitHub
</Button>*/}
<Button
variant="outline"
className="w-full bg-[#1C1C1C] text-white border-gray-800 hover:bg-[#2C2C2C] hover:border-gray-700"
size="lg"
disabled={isSubmitting}
>
<Lock className="mr-2 h-5 w-5" />
Continue with SSO
</Button>
<div className="relative">
<div className="absolute inset-0 flex items-center">
<span className="w-full border-t border-gray-800" />
</div>
<div className="relative flex justify-center text-xs">
<span className="bg-background px-2 text-gray-400">or</span>
</div>
</div>
</div>
<form onSubmit={handleSubmit} className="space-y-4" {...props}>
<FormField
label="Email"
input={
<Input
id="email"
type="email"
name="email"
placeholder="you@example.com"
className={`bg-[#1C1C1C] border-gray-800 text-white placeholder:text-gray-500 focus:border-emerald-600 focus:ring-emerald-600 ${
errors.email ? "border-red-500" : ""
}`}
value={formData.email}
onChange={handleChange}
disabled={isSubmitting}
/>
}
error={errors.email}
/>
{/* <Link
href="email-recovery"
className="flex items-end justify-end text-xs text-gray-400 hover:text-emerald-500"
>
Forgot Email?
</Link> */}
<SubmitButton
className="w-full bg-emerald-600 hover:bg-emerald-700 text-white"
size="lg"
pendingText="Signing In..."
>
Sign In
</SubmitButton>
</form>
<div className="text-center text-lg">
<span className="text-gray-400">Don't have an account? </span>
<Link
href="/contact-us"
className="text-white hover:text-emerald-500"
>
Contact Us
</Link>
</div>
<p className="text-center text-xs text-gray-400">
By continuing, you agree to Sigap's{" "}
<a href="#" className="text-gray-400 hover:text-white">
Terms of Service
</a>{" "}
and{" "}
<a href="#" className="text-gray-400 hover:text-white">
Privacy Policy
</a>
, and to receive periodic emails with updates.
</p>
</div>
</div>
</div>
);
}