From 120c6dd280101e85e36389ac534aa738c5300f31 Mon Sep 17 00:00:00 2001
From: Samuel Andert
Date: Mon, 31 Jul 2023 12:06:57 +0200
Subject: [PATCH] Added dynamic component rendering to Recipies
---
src/lib/components/examples/Recipies.svelte | 24 +++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/lib/components/examples/Recipies.svelte b/src/lib/components/examples/Recipies.svelte
index b5f6df2..e10276c 100644
--- a/src/lib/components/examples/Recipies.svelte
+++ b/src/lib/components/examples/Recipies.svelte
@@ -6,6 +6,7 @@
import { writable, get } from 'svelte/store';
import { createUser } from './userService';
import { derived } from 'svelte/store';
+ import Composite from '$lib/core/Composite.svelte';
const initialFormData = { name: '', age: '' };
@@ -79,12 +80,26 @@
}),
on: {
NEXT: {
- target: 'summary',
+ target: 'litStatus',
actions: ['setEmail']
},
BACK: 'name'
}
},
+ litStatus: {
+ meta: {
+ title: 'LitStatus',
+ buttonLabel: 'next',
+ composite: {
+ id: 'litStatus',
+ component: 'LitStatus'
+ }
+ },
+ on: {
+ NEXT: 'summary',
+ BACK: 'email'
+ }
+ },
summary: {
meta: {
title: 'Summary',
@@ -92,7 +107,8 @@
buttonLabel: 'test'
},
on: {
- SUBMIT: 'submitting'
+ SUBMIT: 'submitting',
+ BACK: 'litStatus'
}
},
submitting: {
@@ -172,6 +188,10 @@
: ''}
+ {#if stateMachine.states[$state.value].meta.composite}
+
+ {/if}
+
{#if $state.value === 'start'}Welcome{:else if $state.value === 'name'}