diff --git a/src/lib/components/cleanup/Flows.svelte b/src/lib/components/cleanup/Flows.svelte deleted file mode 100644 index 934549d..0000000 --- a/src/lib/components/cleanup/Flows.svelte +++ /dev/null @@ -1,79 +0,0 @@ - - - - - Step 1: Name -
- - -
-
- -
-
- - Step 2: Age -
- - -
-
- - -
-
- - Step 3: Confirm Summary -
-

Confirm Summary:

-

Name: {name}

-

Age: {age}

-
-
- - -
-
-
- - diff --git a/src/lib/components/refactor/ComposerForm.svelte b/src/lib/components/refactor/ComposerForm.svelte index ea6b789..4b8c27d 100644 --- a/src/lib/components/refactor/ComposerForm.svelte +++ b/src/lib/components/refactor/ComposerForm.svelte @@ -8,13 +8,17 @@ import SelectInput from './inputFields/SelectInput.svelte'; import TextAreaInput from './inputFields/TextAreaInput.svelte'; import NumberInput from './inputFields/NumberInput.svelte'; - import { derived } from 'svelte/store'; - import { createUser } from './userService'; + import { derived, writable } from 'svelte/store'; + import Stepper from './Stepper.svelte'; export let me; const { fields, validators } = $me.context; + let stepperState = writable({ current: 0, total: fields.length }); + + $: stepperState.update((state) => ({ ...state, current: $state.context.currentField })); + let initialFormData = fields.reduce((acc, field) => { acc[field.name] = field.placeholder; return acc; @@ -169,6 +173,10 @@

{/if} +
+ +
+ {#if fields[$state.context.currentField].type === 'text'} {:else if fields[$state.context.currentField].type === 'email'} diff --git a/src/lib/components/refactor/Stepper.svelte b/src/lib/components/refactor/Stepper.svelte new file mode 100644 index 0000000..9d4811a --- /dev/null +++ b/src/lib/components/refactor/Stepper.svelte @@ -0,0 +1,35 @@ + + + +{#if $stepperState.total} +
+ {#each Array.from(Array($stepperState.total).keys()) as step} +
+ + {isActive(step) ? `${stepStateName}` : ` ${step + 1}`} + +
+ {/each} +
+{/if}