chatbot-template/components/chat/auth-form.tsx

54 lines
1.5 KiB
TypeScript
Raw Normal View History

import Form from "next/form";
2024-10-23 12:33:19 -04:00
import { Input } from "../ui/input";
import { Label } from "../ui/label";
2024-10-11 18:00:22 +05:30
export function AuthForm({
action,
children,
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 (
<Form action={action} className="flex flex-col gap-4">
2024-10-11 18:00:22 +05:30
<div className="flex flex-col gap-2">
<Label className="font-normal text-muted-foreground" htmlFor="email">
Email
2024-10-11 18:00:22 +05:30
</Label>
<Input
autoComplete="email"
autoFocus
className="h-10 rounded-lg border-border/50 bg-muted/50 text-sm transition-colors focus:border-foreground/20 focus:bg-muted"
defaultValue={defaultEmail}
2024-10-11 18:00:22 +05:30
id="email"
name="email"
placeholder="you@someo.ne"
2024-10-11 18:00:22 +05:30
required
type="email"
2024-10-11 18:00:22 +05:30
/>
</div>
2024-10-11 18:00:22 +05:30
<div className="flex flex-col gap-2">
<Label className="font-normal text-muted-foreground" htmlFor="password">
2024-10-11 18:00:22 +05:30
Password
</Label>
<Input
className="h-10 rounded-lg border-border/50 bg-muted/50 text-sm transition-colors focus:border-foreground/20 focus:bg-muted"
2024-10-11 18:00:22 +05:30
id="password"
name="password"
placeholder="&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;"
required
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
);
}