fix: Ajout du mode Visu

This commit is contained in:
N3WT DE COMPET
2025-05-04 14:32:06 +02:00
parent 4ecf25a6ab
commit e1c607308c
29 changed files with 531 additions and 414 deletions

View File

@ -9,6 +9,7 @@ export default function InputText({
placeholder,
className,
required,
enable = true, // Nouvelle prop pour activer/désactiver le champ
}) {
return (
<>
@ -25,7 +26,9 @@ export default function InputText({
errorMsg || errorLocalMsg
? 'border-red-500 hover:border-red-700'
: 'border-gray-200 hover:border-gray-400'
} ${!errorMsg && !errorLocalMsg ? 'focus-within:border-gray-500' : ''}`}
} ${!errorMsg && !errorLocalMsg ? 'focus-within:border-gray-500' : ''} ${
!enable ? 'bg-gray-100 cursor-not-allowed' : ''
}`}
>
<input
type={type}
@ -33,9 +36,12 @@ export default function InputText({
placeholder={placeholder}
name={name}
value={value}
onChange={onChange}
className="flex-1 px-3 py-2 block w-full sm:text-sm border-none focus:ring-0 outline-none rounded-md"
onChange={enable ? onChange : undefined} // Désactiver onChange si enable est false
className={`flex-1 px-3 py-2 block w-full sm:text-sm border-none focus:ring-0 outline-none rounded-md ${
!enable ? 'bg-gray-100 cursor-not-allowed' : ''
}`}
required={required}
readOnly={!enable ? 'readOnly' : ''} // Activer le mode readonly si enable est false
/>
</div>
{errorMsg && <p className="mt-2 text-sm text-red-600">{errorMsg}</p>}