2025-09-20 12:47:10 -07:00
|
|
|
import Form from "next/form";
|
2024-10-23 12:33:19 -04:00
|
|
|
|
2025-09-20 12:47:10 -07:00
|
|
|
import { Input } from "./ui/input";
|
|
|
|
|
import { Label } from "./ui/label";
|
2024-10-11 18:00:22 +05:30
|
|
|
|
|
|
|
|
export function AuthForm({
|
|
|
|
|
action,
|
|
|
|
|
children,
|
2025-09-20 12:47:10 -07:00
|
|
|
defaultEmail = "",
|
2024-10-11 18:00:22 +05:30
|
|
|
}: {
|
2024-11-15 12:18:17 -05:00
|
|
|
action: NonNullable<
|
|
|
|
|
string | ((formData: FormData) => void | Promise<void>) | undefined
|
|
|
|
|
>;
|
2024-10-11 18:00:22 +05:30
|
|
|
children: React.ReactNode;
|
|
|
|
|
defaultEmail?: string;
|
|
|
|
|
}) {
|
|
|
|
|
return (
|
2024-10-23 12:33:19 -04:00
|
|
|
<Form action={action} className="flex flex-col gap-4 px-4 sm:px-16">
|
2024-10-11 18:00:22 +05:30
|
|
|
<div className="flex flex-col gap-2">
|
|
|
|
|
<Label
|
2025-09-09 15:44:07 -04:00
|
|
|
className="font-normal text-zinc-600 dark:text-zinc-400"
|
2025-09-20 12:47:10 -07:00
|
|
|
htmlFor="email"
|
2024-10-11 18:00:22 +05:30
|
|
|
>
|
|
|
|
|
Email Address
|
|
|
|
|
</Label>
|
|
|
|
|
|
|
|
|
|
<Input
|
2025-09-20 12:47:10 -07:00
|
|
|
autoComplete="email"
|
|
|
|
|
autoFocus
|
|
|
|
|
className="bg-muted text-md md:text-sm"
|
|
|
|
|
defaultValue={defaultEmail}
|
2024-10-11 18:00:22 +05:30
|
|
|
id="email"
|
|
|
|
|
name="email"
|
|
|
|
|
placeholder="user@acme.com"
|
|
|
|
|
required
|
2025-09-20 12:47:10 -07:00
|
|
|
type="email"
|
2024-10-11 18:00:22 +05:30
|
|
|
/>
|
2024-11-05 23:30:25 +03:00
|
|
|
</div>
|
2024-10-11 18:00:22 +05:30
|
|
|
|
2024-11-05 23:30:25 +03:00
|
|
|
<div className="flex flex-col gap-2">
|
2024-10-11 18:00:22 +05:30
|
|
|
<Label
|
2025-09-09 15:44:07 -04:00
|
|
|
className="font-normal text-zinc-600 dark:text-zinc-400"
|
2025-09-20 12:47:10 -07:00
|
|
|
htmlFor="password"
|
2024-10-11 18:00:22 +05:30
|
|
|
>
|
|
|
|
|
Password
|
|
|
|
|
</Label>
|
|
|
|
|
|
|
|
|
|
<Input
|
2025-09-20 12:47:10 -07:00
|
|
|
className="bg-muted text-md md:text-sm"
|
2024-10-11 18:00:22 +05:30
|
|
|
id="password"
|
|
|
|
|
name="password"
|
|
|
|
|
required
|
2025-09-20 12:47:10 -07:00
|
|
|
type="password"
|
2024-10-11 18:00:22 +05:30
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{children}
|
2024-10-23 12:33:19 -04:00
|
|
|
</Form>
|
2024-10-11 18:00:22 +05:30
|
|
|
);
|
|
|
|
|
}
|