From 720282dbfd34cb07da9fc23a134121d26a6a7979 Mon Sep 17 00:00:00 2001 From: Samuel Andert Date: Tue, 8 Aug 2023 08:41:47 +0200 Subject: [PATCH] Successfully abstracted the InputTypes to dynamically composer Forms. --- .../components/refactor/ComposerForm.svelte | 72 ++++++------------- .../refactor/inputfields/NumberInput.svelte | 20 ++++++ .../refactor/inputfields/SelectInput.svelte | 37 ++++------ .../refactor/inputfields/SliderInput.svelte | 31 ++++---- .../refactor/inputfields/TextAreaInput.svelte | 19 +++++ .../refactor/inputfields/TextInput.svelte | 58 +++------------ .../refactor/inputfields/ToggleInput.svelte | 9 +-- 7 files changed, 98 insertions(+), 148 deletions(-) create mode 100644 src/lib/components/refactor/inputfields/NumberInput.svelte create mode 100644 src/lib/components/refactor/inputfields/TextAreaInput.svelte diff --git a/src/lib/components/refactor/ComposerForm.svelte b/src/lib/components/refactor/ComposerForm.svelte index 260f480..b75406c 100644 --- a/src/lib/components/refactor/ComposerForm.svelte +++ b/src/lib/components/refactor/ComposerForm.svelte @@ -2,8 +2,12 @@ import { superForm } from 'sveltekit-superforms/client'; import { afterUpdate } from 'svelte'; import { writable } from 'svelte/store'; - import { RangeSlider, SlideToggle } from '@skeletonlabs/skeleton'; - import TextInput from './inputfields/TextInput.svelte'; + import TextInput from './inputFields/TextInput.svelte'; + import ToggleInput from './inputFields/ToggleInput.svelte'; + import SliderInput from './inputFields/SliderInput.svelte'; + import SelectInput from './inputFields/SelectInput.svelte'; + import TextAreaInput from './inputFields/TextAreaInput.svelte'; + import NumberInput from './inputFields/NumberInput.svelte'; export let me; @@ -52,7 +56,6 @@ } function handleReset() { - // Reset the form and remove the message form.set({}); successMessage.set(null); } @@ -69,18 +72,15 @@
My ID is: {$me.id}
My state is: {$me.state} -
- -
- {#if $successMessage} -