Added dynamic component rendering to Recipies
This commit is contained in:
parent
6092199fe5
commit
120c6dd280
@ -6,6 +6,7 @@
|
|||||||
import { writable, get } from 'svelte/store';
|
import { writable, get } from 'svelte/store';
|
||||||
import { createUser } from './userService';
|
import { createUser } from './userService';
|
||||||
import { derived } from 'svelte/store';
|
import { derived } from 'svelte/store';
|
||||||
|
import Composite from '$lib/core/Composite.svelte';
|
||||||
|
|
||||||
const initialFormData = { name: '', age: '' };
|
const initialFormData = { name: '', age: '' };
|
||||||
|
|
||||||
@ -79,12 +80,26 @@
|
|||||||
}),
|
}),
|
||||||
on: {
|
on: {
|
||||||
NEXT: {
|
NEXT: {
|
||||||
target: 'summary',
|
target: 'litStatus',
|
||||||
actions: ['setEmail']
|
actions: ['setEmail']
|
||||||
},
|
},
|
||||||
BACK: 'name'
|
BACK: 'name'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
litStatus: {
|
||||||
|
meta: {
|
||||||
|
title: 'LitStatus',
|
||||||
|
buttonLabel: 'next',
|
||||||
|
composite: {
|
||||||
|
id: 'litStatus',
|
||||||
|
component: 'LitStatus'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
on: {
|
||||||
|
NEXT: 'summary',
|
||||||
|
BACK: 'email'
|
||||||
|
}
|
||||||
|
},
|
||||||
summary: {
|
summary: {
|
||||||
meta: {
|
meta: {
|
||||||
title: 'Summary',
|
title: 'Summary',
|
||||||
@ -92,7 +107,8 @@
|
|||||||
buttonLabel: 'test'
|
buttonLabel: 'test'
|
||||||
},
|
},
|
||||||
on: {
|
on: {
|
||||||
SUBMIT: 'submitting'
|
SUBMIT: 'submitting',
|
||||||
|
BACK: 'litStatus'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
submitting: {
|
submitting: {
|
||||||
@ -172,6 +188,10 @@
|
|||||||
: ''}
|
: ''}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
{#if stateMachine.states[$state.value].meta.composite}
|
||||||
|
<Composite composite={stateMachine.states[$state.value].meta.composite} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
{#if $state.value === 'start'}Welcome{:else if $state.value === 'name'}
|
{#if $state.value === 'start'}Welcome{:else if $state.value === 'name'}
|
||||||
<form on:submit|preventDefault={handleSubmit} class="w-full max-w-lg">
|
<form on:submit|preventDefault={handleSubmit} class="w-full max-w-lg">
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user