

type FormErrorsProps = {
    errors: Record<string, string>;
};

export default function FormErrors({ errors, }: FormErrorsProps) {
    const errorList = Object.values(errors);

    if (errorList.length === 0) return null;

    return (
        <div className="  mb-4 rounded-sm border p-4 text-sm  border-red-300 bg-red-50 text-red-800  dark:border-red-800 dark:bg-red-950/40 dark:text-red-300"  >
            <ul className="list-disc space-y-2 pl-5">
                {errorList.map((error, index) => (
                    <li key={index}>{error}</li>
                ))}
            </ul>
        </div>
    );
}