"use client" import { useState, useRef, useEffect } from "react" import { Button } from "@/components/ui/button" import { Gift, Shield, Sparkles, Phone, Mail } from "lucide-react" interface Props { onSubmit: (data: { donorName: string donorEmail: string donorPhone: string giftAid: boolean }) => void amount: number } export function IdentityStep({ onSubmit, amount }: Props) { const [name, setName] = useState("") const [email, setEmail] = useState("") const [phone, setPhone] = useState("") const [giftAid, setGiftAid] = useState(false) const [submitting, setSubmitting] = useState(false) const [contactMode, setContactMode] = useState<"email" | "phone">("email") const nameRef = useRef(null) useEffect(() => { nameRef.current?.focus() }, []) const hasContact = contactMode === "email" ? email.includes("@") : phone.length >= 10 const isValid = hasContact const giftAidBonus = Math.round(amount * 0.25) const totalWithAid = amount + giftAidBonus const handleSubmit = async () => { if (!isValid) return setSubmitting(true) try { await onSubmit({ donorName: name, donorEmail: email, donorPhone: phone, giftAid }) } catch { setSubmitting(false) } } return (

Almost there!

We just need a way to send you payment details

{/* Minimal form */}
{/* Name */}
setName(e.target.value)} autoComplete="name" className="w-full h-14 px-4 rounded-2xl border-2 border-gray-200 bg-white text-base font-medium placeholder:text-gray-300 focus:border-trust-blue focus:ring-4 focus:ring-trust-blue/10 outline-none transition-all" /> {name && (
)}
{/* Contact mode toggle */}
{/* Contact input */} {contactMode === "email" ? (
setEmail(e.target.value)} autoComplete="email" inputMode="email" className="w-full h-14 pl-12 pr-4 rounded-2xl border-2 border-gray-200 bg-white text-base font-medium placeholder:text-gray-300 focus:border-trust-blue focus:ring-4 focus:ring-trust-blue/10 outline-none transition-all" />
) : (
setPhone(e.target.value)} autoComplete="tel" inputMode="tel" className="w-full h-14 pl-12 pr-4 rounded-2xl border-2 border-gray-200 bg-white text-base font-medium placeholder:text-gray-300 focus:border-trust-blue focus:ring-4 focus:ring-trust-blue/10 outline-none transition-all" />

We'll send reminders via WhatsApp ✓

)}
{/* Gift Aid — the hero */} {/* Submit */}
Your data is encrypted and only used for this pledge
) }