import type { FormEvent } from 'react' import type { I18nNode, I18nString } from '@pikku/react' import { Box, Button, Card, Container, PasswordInput, Stack, Text, TextInput, Title, } from '@pikku/mantine/core' import { m } from '@/i18n/messages' import { useLocale } from '@/i18n/config' type AuthCardProps = { title: I18nString description: I18nString cta: I18nString email: string password: string // 'current-password' on login (let the browser fill a saved password), // 'new-password' on signup (let it suggest a strong one). passwordAutoComplete: 'current-password' | 'new-password' busy: boolean message: I18nString | null error: I18nString | null footer: I18nNode onEmailChange: (value: string) => void onPasswordChange: (value: string) => void onSubmit: (event: FormEvent) => void } export function AuthCard(props: AuthCardProps) { useLocale() return (
{m.auth__eyebrow()} {props.title} {props.description}
props.onEmailChange(event.currentTarget.value)} required radius="md" type="email" autoComplete="email" /> props.onPasswordChange(event.currentTarget.value)} required radius="md" autoComplete={props.passwordAutoComplete} />
{props.message ? {props.message} : null} {props.error ? {props.error} : null} {props.footer}
) }