SPB Git forge

spb/rareindex

Public
54commits 1branches 0releases
7.1 MBsize
maindefault branch
10 days agolast push
TypeScript 61.9% HTML 37.2% SQL 0.7%
1.3 KB · 31 lines tsx
Raw Blame History
1'use client';23import Link from 'next/link';4import { useActionState } from 'react';5import { loginAction } from '@/lib/auth/actions';6import { idle } from '@/lib/auth/state';7import { Field, FormMessage, PasswordField, SubmitButton, TextInput } from '@/components/account/form';89export function LoginForm({ next }: { next: string }) {10  const [state, action] = useActionState(loginAction, idle);11  return (12    <form action={action} className="mt-6 space-y-4" noValidate>13      <input type="hidden" name="next" value={next} />14      <FormMessage state={state} />15      <Field label="E-mail" name="email" error={state.fieldErrors?.email}>16        <TextInput name="email" type="email" autoComplete="email" required autoFocus placeholder="you@example.com" invalid={Boolean(state.fieldErrors?.email)} />17      </Field>18      <PasswordField name="password" autoComplete="current-password" showMeter={false} error={state.fieldErrors?.password} />19      <div className="flex items-center justify-between">20        <span />21        <Link href="/forgot" className="text-xs font-medium text-muted hover:text-fg">22          Forgot password?23        </Link>24      </div>25      <SubmitButton className="w-full" pendingText="Signing in…">26        Continue27      </SubmitButton>28    </form>29  );30}31