import React from 'react'; import { cn } from '@/lib/utils'; /** * FormError Component * Display error messages with different variants and animations */ export interface FormErrorProps { errors?: string | string[]; variant?: 'inline' | 'block' | 'toast'; className?: string; showIcon?: boolean; animate?: boolean; id?: string; } export const FormError: React.FC = ({ errors, variant = 'inline', className, showIcon = true, animate = true, id, }) => { if (!errors || (Array.isArray(errors) && errors.length === 0)) { return null; } const errorArray = Array.isArray(errors) ? errors : [errors]; const hasMultipleErrors = errorArray.length > 1; const baseClasses = { inline: 'text-sm text-danger mt-1', block: 'p-3 bg-danger/10 border border-danger/20 rounded-md text-danger text-sm', toast: 'fixed bottom-4 right-4 p-4 bg-danger text-white rounded-lg shadow-lg max-w-md z-tooltip animate-slide-up', }; const animationClasses = animate ? 'animate-fade-in' : ''; const Icon = () => ( ); return ( ); }; FormError.displayName = 'FormError'; export default FormError;