forked from fahrPool/fahrPool
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { login } from "./actions";
|
|
import { Button } from "@/components/ui/Button";
|
|
import { Card } from "@/components/ui/Card";
|
|
import { Alert } from "@/components/ui/Alert";
|
|
import { FormField, FIELD_CLASSES } from "@/components/ui/FormField";
|
|
|
|
export default async function LoginPage({
|
|
searchParams,
|
|
}: {
|
|
searchParams: Promise<{ error?: string }>;
|
|
}) {
|
|
const { error } = await searchParams;
|
|
|
|
return (
|
|
<div className="flex flex-1 items-center justify-center px-4 py-8">
|
|
<Card className="w-full max-w-sm">
|
|
<h1 className="mb-6 text-center text-xl font-semibold text-asphalt-grey">Anmelden</h1>
|
|
{error && (
|
|
<div className="mb-4">
|
|
<Alert>{error}</Alert>
|
|
</div>
|
|
)}
|
|
<form action={login}>
|
|
<FormField label="E-Mail" htmlFor="email">
|
|
<input id="email" name="email" type="email" required className={FIELD_CLASSES} />
|
|
</FormField>
|
|
<FormField label="Passwort" htmlFor="password">
|
|
<input id="password" name="password" type="password" required className={FIELD_CLASSES} />
|
|
</FormField>
|
|
<Button type="submit">Anmelden</Button>
|
|
</form>
|
|
</Card>
|
|
</div>
|
|
);
|
|
}
|