Updated Summary page UI

This commit is contained in:
Samuel Andert 2023-08-08 16:15:54 +02:00
parent f568c83f16
commit 503773b121

View File

@ -45,7 +45,7 @@
on: {
NEXT: [
{
target: 'submitting',
target: 'summary',
actions: assign({
formData: (context, event) => ({
...context.formData,
@ -76,7 +76,7 @@
}
}
},
submitting: {
summary: {
on: {
SUBMIT: 'submitted',
PREV: {
@ -123,7 +123,7 @@
}
const fieldValue = $form[currentFieldName];
if ($state.matches('submitting')) {
if ($state.matches('summary')) {
send('SUBMIT');
} else {
send('NEXT', { fieldValue });
@ -192,12 +192,20 @@
{/if}
</div>
{/if}
{#if $state.matches('submitting')}
{#if $state.matches('summary')}
<div class="mb-4">
<h2 class="text-lg font-semibold text-white">Summary</h2>
{#each Object.entries($state.context.formData) as [key, value]}
<p class="mt-1 text-white">{key}: {value}</p>
{/each}
<h2 class="mb-2 text-5xl font-semibold text-center text-white">Summary</h2>
<p class="text-2xl text-center text-white">Please verify your summary</p>
<dl class="list-dl">
{#each Object.entries($state.context.formData) as [key, value]}
<div>
<span class="flex-auto">
<dt class="text-sm text-gray-300">{key}</dt>
<dd class="text-2xl font-semibold">{value}</dd>
</span>
</div>
{/each}
</dl>
</div>
{/if}
{#if $state.matches('submitted')}