From d138c15dcd4272cd2358d28867ef35d1550b39cd Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Mon, 15 May 2023 20:35:39 -0600 Subject: Mejora renderizado de formularios --- src/components/forms/fields/field.tsx | 23 +++++++++++++++++++++++ src/components/forms/fields/field_properties.ts | 9 +++++++++ src/components/forms/fields/select_field.tsx | 10 ++++++++++ 3 files changed, 42 insertions(+) create mode 100644 src/components/forms/fields/field.tsx create mode 100644 src/components/forms/fields/field_properties.ts create mode 100644 src/components/forms/fields/select_field.tsx (limited to 'src/components/forms/fields') diff --git a/src/components/forms/fields/field.tsx b/src/components/forms/fields/field.tsx new file mode 100644 index 0000000..d7aa342 --- /dev/null +++ b/src/components/forms/fields/field.tsx @@ -0,0 +1,23 @@ +export default function Field({ properties }) { + let field_component; + + if(properties.error_message) { + field_component = ( +
+ + +

{properties.error_message }

+
+ ); + } + else { + field_component = ( +
+ + +
+ ); + } + + return field_component; +} \ No newline at end of file diff --git a/src/components/forms/fields/field_properties.ts b/src/components/forms/fields/field_properties.ts new file mode 100644 index 0000000..d4e8066 --- /dev/null +++ b/src/components/forms/fields/field_properties.ts @@ -0,0 +1,9 @@ +export default interface FieldProperties { + type: string; + id: string; + name: string; + label: string; + placeholder?: string; + error_message?: string; +} + diff --git a/src/components/forms/fields/select_field.tsx b/src/components/forms/fields/select_field.tsx new file mode 100644 index 0000000..75859d9 --- /dev/null +++ b/src/components/forms/fields/select_field.tsx @@ -0,0 +1,10 @@ +export default function SelectField({ properties, options }) { + return( +
+ + +
+ ); +} \ No newline at end of file -- cgit v1.2.3