From 844334bd2715e2529c7bd8c67483995546e964e1 Mon Sep 17 00:00:00 2001
From: Samuel Andert
Date: Tue, 8 Aug 2023 13:41:30 +0200
Subject: [PATCH] added some more Stepper UI sugar
---
src/lib/components/cleanup/Flows.svelte | 79 -------------------
.../components/refactor/ComposerForm.svelte | 12 ++-
src/lib/components/refactor/Stepper.svelte | 35 ++++++++
3 files changed, 45 insertions(+), 81 deletions(-)
delete mode 100644 src/lib/components/cleanup/Flows.svelte
create mode 100644 src/lib/components/refactor/Stepper.svelte
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}
+
+{/if}