diff --git a/src/components/contact/ContactForm.tsx b/src/components/contact/ContactForm.tsx index 15bbb4e..4c57fcd 100644 --- a/src/components/contact/ContactForm.tsx +++ b/src/components/contact/ContactForm.tsx @@ -15,6 +15,8 @@ interface FormData { export function ContactForm() { const t = useTranslations('pages.contact'); + const MAX_MESSAGE_LENGTH = 1000; + const [isSubmitting, setIsSubmitting] = useState(false); const [submitStatus, setSubmitStatus] = useState<'idle' | 'success' | 'error'>('idle'); const [formData, setFormData] = useState({ @@ -24,6 +26,8 @@ export function ContactForm() { }); const [errors, setErrors] = useState>({}); + const messageLength = formData.message.length; + const validateForm = () => { const newErrors: Partial = {}; @@ -276,6 +280,19 @@ export function ContactForm() { {errors.message && (

{errors.message}

)} +
+

MAX_MESSAGE_LENGTH + ? 'text-red-500' + : messageLength >= MAX_MESSAGE_LENGTH * 0.8 + ? 'text-yellow-500' + : 'text-zinc-500' + }`} + > + {messageLength} / {MAX_MESSAGE_LENGTH} characters +

+