mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
fix: Ajout du mode Visu
This commit is contained in:
@ -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>}
|
||||
|
||||
Reference in New Issue
Block a user