From 20563628e38ded7468d8e44ab2a63bcc2bca434b Mon Sep 17 00:00:00 2001 From: Samuel Andert Date: Tue, 8 Aug 2023 09:30:39 +0200 Subject: [PATCH] Generically populate each input field as a custom step duiring the form process flow --- .../components/refactor/ComposerForm.svelte | 213 +++++++++++------- 1 file changed, 134 insertions(+), 79 deletions(-) diff --git a/src/lib/components/refactor/ComposerForm.svelte b/src/lib/components/refactor/ComposerForm.svelte index 378f520..70593dc 100644 --- a/src/lib/components/refactor/ComposerForm.svelte +++ b/src/lib/components/refactor/ComposerForm.svelte @@ -1,7 +1,7 @@
- My ID is: {$me.id}
- My state is: {$me.state} - {#if $me.state === 'validated'} - - {:else} -
- {#each fields as field (field.name)} -
- {#if $errors[field.name]} - {$errors[field.name]} - {:else} - - {/if} - {#if field.type === 'text'} - - {:else if field.type === 'email'} - - {:else if field.type === 'textarea'} - - {:else if field.type === 'select'} - - {:else if field.type === 'slider'} - - {:else if field.type === 'toggle'} - - {:else if field.type === 'number'} - - {/if} -
- {/each} + {fields[$state.context.currentField].name.charAt(0).toUpperCase() + + fields[$state.context.currentField].name.slice(1)} + + {/if} + {#if fields[$state.context.currentField].type === 'text'} + + {:else if fields[$state.context.currentField].type === 'email'} + + {:else if fields[$state.context.currentField].type === 'textarea'} + + {:else if fields[$state.context.currentField].type === 'select'} + + {:else if fields[$state.context.currentField].type === 'slider'} + + {:else if fields[$state.context.currentField].type === 'toggle'} + + {:else if fields[$state.context.currentField].type === 'number'} + + {/if} +
+
+ + - - {/if} +
+