ai-chatbot/components/auth-form.tsx
Your Name 53ddb7e585
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
Initial commit - clean repository
2025-12-17 20:15:18 +08:00

63 lines
1.4 KiB
TypeScript

import Form from "next/form";
import { Input } from "./ui/input";
import { Label } from "./ui/label";
export function AuthForm({
action,
children,
defaultEmail = "",
className = "",
}: {
action: NonNullable<
string | ((formData: FormData) => void | Promise<void>) | undefined
>;
children: React.ReactNode;
defaultEmail?: string;
className?: string;
}) {
return (
<Form action={action} className={`flex flex-col gap-4 px-4 sm:px-16 ${className}`}>
<div className="flex flex-col gap-2">
<Label
className="font-normal text-zinc-600 dark:text-zinc-400"
htmlFor="email"
>
邮箱地址
</Label>
<Input
autoComplete="email"
autoFocus
className="bg-muted text-md md:text-sm"
defaultValue={defaultEmail}
id="email"
name="email"
placeholder="user@example.com"
required
type="email"
/>
</div>
<div className="flex flex-col gap-2">
<Label
className="font-normal text-zinc-600 dark:text-zinc-400"
htmlFor="password"
>
登录密码
</Label>
<Input
className="bg-muted text-md md:text-sm"
id="password"
name="password"
required
type="password"
/>
</div>
{children}
</Form>
);
}