diff --git a/src/app/components/ResumeForm/Form/InputGroup.tsx b/src/app/components/ResumeForm/Form/InputGroup.tsx index 22c8156..909f965 100644 --- a/src/app/components/ResumeForm/Form/InputGroup.tsx +++ b/src/app/components/ResumeForm/Form/InputGroup.tsx @@ -11,6 +11,7 @@ interface InputProps { value?: V; placeholder: string; onChange: (name: K, value: V) => void; + maxLength?: number; } /** @@ -42,6 +43,7 @@ export const Input = ({ onChange, label, labelClassName, + maxLength, }: InputProps) => { return ( @@ -52,7 +54,12 @@ export const Input = ({ placeholder={placeholder} onChange={(e) => onChange(name, e.target.value)} className={INPUT_CLASS_NAME} + maxLength={maxLength} /> +
+ {value.length} + {maxLength ? ` / ${maxLength}` : ""} characters +
); }; @@ -64,6 +71,7 @@ export const Textarea = ({ value = "", placeholder, onChange, + maxLength, }: InputProps) => { const textareaRef = useAutosizeTextareaHeight({ value }); @@ -76,7 +84,12 @@ export const Textarea = ({ placeholder={placeholder} value={value} onChange={(e) => onChange(name, e.target.value)} + maxLength={maxLength} /> +
+ {value.length} + {maxLength ? ` / ${maxLength}` : ""} characters +
); }; @@ -122,7 +135,7 @@ const BulletListTextareaGeneral = ({ showBulletPoints = true, }: InputProps & { showBulletPoints?: boolean }) => { const html = getHTMLFromBulletListStrings(bulletListStrings); - const charCount = bulletListStrings.join(" ").length; + const charCount = bulletListStrings.join(" ").length; const maxChars = 300; return ( @@ -144,7 +157,11 @@ const BulletListTextareaGeneral = ({ }} html={html} /> -
maxChars ? "text-red-500" : "text-gray-400"}`}> +
maxChars ? "text-red-500" : "text-gray-400" + }`} + > {charCount} / {maxChars} characters