clear form on submit
All checks were successful
Vercel Production Deployment / Deploy-Production (push) Successful in 1m19s
Vercel Preview Deployment / Deploy-Preview (push) Successful in 1m32s

This commit is contained in:
ChrQR 2024-06-03 11:47:02 +02:00
parent 29b09848b0
commit 533398cdb3

View File

@ -22,20 +22,24 @@ export default function CreateCountryForm() {
}
}, [formState.message]);
return (
<form action={formAction} className="flex flex-col gap-2">
<form ref={formRef} action={formAction} className="flex flex-col gap-2">
<div className="flex items-center gap-2">
<Input
name="name"
id="name"
className={clsx({ "border-red-500": formState.errors?.name })}
/>
{formState.message === "success" ? (
<Check className="text-green-400" />
<Check className="text-green-500" />
) : (
<div className="flex items-center gap-2">
<CircleX className="text-red-600" />
<span>{formState.errors?.name}</span>{" "}
</div>
""
)}
{formState.message === "error" ? (
<CircleX className="text-red-500" />
) : (
""
)}
</div>
<SubmitButton text={"Country"} />
</form>
);