mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-04-20 03:50:20 +00:00
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m29s
43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
"use client";
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
import { signin } from "@/actions/auth-actions";
|
|
import { Loader2 } from "lucide-react";
|
|
import { useActionState } from "react";
|
|
import { PhoneInput } from "../ui/phone-input";
|
|
|
|
export default function LoginForm() {
|
|
const [state, formAction, isPending] = useActionState(signin, {
|
|
message: "",
|
|
status: "",
|
|
});
|
|
|
|
return (
|
|
<form
|
|
className="overflow-clip title-bg dark:border-2 w-full max-w-xs mx-auto rounded-lg shadow border mt-4"
|
|
action={formAction}
|
|
>
|
|
<div className="py-4 px-4">
|
|
<div className="grid gap-4">
|
|
<PhoneInput
|
|
id="phone-number"
|
|
name="phoneNumber"
|
|
maxLength={8}
|
|
disabled={isPending}
|
|
placeholder="Enter phone number"
|
|
defaultCountry="MV"
|
|
/>
|
|
|
|
{state.status === "error" && (
|
|
<p className="text-red-500 text-sm">{state.message}</p>
|
|
)}
|
|
<Button className="" disabled={isPending} type="submit">
|
|
{isPending ? <Loader2 className="animate-spin" /> : "Login"}
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
);
|
|
}
|