diff options
author | HombreLaser <sebastian-440@live.com> | 2023-05-18 22:04:52 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2023-05-18 22:04:52 -0600 |
commit | 44a016256717b871ada858d5dc064d9d0e06425e (patch) | |
tree | 008bb13cc1b10355f335e24e46d0d74e85669364 /src/components/forms/fields | |
parent | 2cc3bd2a5ab71ced121ea6e8fef3be5db2b98e4f (diff) |
Añade creación de direcciones
Diffstat (limited to 'src/components/forms/fields')
-rw-r--r-- | src/components/forms/fields/select_field.tsx | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/components/forms/fields/select_field.tsx b/src/components/forms/fields/select_field.tsx index 75859d9..4d67754 100644 --- a/src/components/forms/fields/select_field.tsx +++ b/src/components/forms/fields/select_field.tsx @@ -1,10 +1,26 @@ export default function SelectField({ properties, options }) { - return( - <div className="mb-6"> - <label className="block mb-2 text-lg text-gray-900 dark:text-white">{properties.label}</label> - <select id={properties.id} className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"> - {options} - </select> - </div> - ); + let select_field; + + if(properties.error_message) { + select_field = ( + <div className="mb-6"> + <label className="block mb-2 text-lg text-red-700 dark:text-red-500">{properties.label}</label> + <select id={properties.id} name={properties.name} className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"> + {options} + </select> + <p className="mt-2 text-sm text-red-600 dark:text-red-500"> {properties.error_message }</p> + </div> + ); + } else { + select_field = ( + <div className="mb-6"> + <label className="block mb-2 text-lg text-gray-900 dark:text-white">{properties.label}</label> + <select id={properties.id} name={properties.name} className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"> + {options} + </select> + </div> + ); + } + + return select_field; }
\ No newline at end of file |