diff --git a/src/lib/components/steps.svelte b/src/lib/components/steps.svelte index c22a069d4..5d0d82c24 100644 --- a/src/lib/components/steps.svelte +++ b/src/lib/components/steps.svelte @@ -1,18 +1,24 @@
    {#if steps} {#each steps as step, index} + {@const stepNumber = index + 1} {/each} {/if} diff --git a/src/lib/elements/forms/form.svelte b/src/lib/elements/forms/form.svelte index 020eabd08..dcc806372 100644 --- a/src/lib/elements/forms/form.svelte +++ b/src/lib/elements/forms/form.svelte @@ -1,3 +1,4 @@ -
    + + diff --git a/src/lib/layout/index.ts b/src/lib/layout/index.ts index 56f7303a7..449707740 100644 --- a/src/lib/layout/index.ts +++ b/src/lib/layout/index.ts @@ -7,5 +7,6 @@ export { default as Notification } from './notification.svelte'; export { default as Notifications } from './notifications.svelte'; export { default as Shell } from './shell.svelte'; export { default as Wizard } from './wizard.svelte'; +export { default as WizardStep } from './wizardStep.svelte'; export { default as Breadcrumbs } from './breadcrumbs.svelte'; export { default as Unauthenticated } from './unauthenticated.svelte'; diff --git a/src/lib/layout/shell.svelte b/src/lib/layout/shell.svelte index 2a72a878b..181e3aade 100644 --- a/src/lib/layout/shell.svelte +++ b/src/lib/layout/shell.svelte @@ -16,6 +16,7 @@ import { user } from '$lib/stores/user'; import { goto } from '$app/navigation'; import { browser } from '$app/environment'; + import { wizard } from '$lib/stores/wizard'; export let isOpen = false; export let showSideNavigation = false; @@ -105,7 +106,8 @@
    + class:is-open={isOpen} + class:u-hide={$wizard.show}>
    -
    + + + - -
    - -
    -
    - -
    - -{/if} - - + +
    + +
    +
    +
    + {#each sortedSteps as [step, { component }]} + {#if currentStep === step} + + {/if} + {/each} + + +
    + diff --git a/src/lib/layout/wizardStep.svelte b/src/lib/layout/wizardStep.svelte new file mode 100644 index 000000000..e904411b8 --- /dev/null +++ b/src/lib/layout/wizardStep.svelte @@ -0,0 +1,10 @@ +
    +

    + +

    +

    + +

    +
    + + diff --git a/src/lib/mock/wizard.container.test.svelte b/src/lib/mock/wizard.container.test.svelte new file mode 100644 index 000000000..66fb98cdb --- /dev/null +++ b/src/lib/mock/wizard.container.test.svelte @@ -0,0 +1,7 @@ + + +{#if $wizard.show && $wizard.component} + +{/if} diff --git a/src/lib/mock/wizard.step1.test.svelte b/src/lib/mock/wizard.step1.test.svelte new file mode 100644 index 000000000..65878a86c --- /dev/null +++ b/src/lib/mock/wizard.step1.test.svelte @@ -0,0 +1,10 @@ + + + + step-1 + sub-title-1 + + + diff --git a/src/lib/mock/wizard.step2.test.svelte b/src/lib/mock/wizard.step2.test.svelte new file mode 100644 index 000000000..880e84ae1 --- /dev/null +++ b/src/lib/mock/wizard.step2.test.svelte @@ -0,0 +1,10 @@ + + + + step-2 + sub-title-2 + + + diff --git a/src/lib/mock/wizard.test.svelte b/src/lib/mock/wizard.test.svelte new file mode 100644 index 000000000..677516f01 --- /dev/null +++ b/src/lib/mock/wizard.test.svelte @@ -0,0 +1,24 @@ + + + diff --git a/src/lib/stores/wizard.ts b/src/lib/stores/wizard.ts new file mode 100644 index 000000000..88167f4bf --- /dev/null +++ b/src/lib/stores/wizard.ts @@ -0,0 +1,34 @@ +import type { SvelteComponent } from 'svelte'; +import { writable } from 'svelte/store'; + +export type WizardStore = { + show: boolean; + component?: typeof SvelteComponent; +}; + +function createWizardStore() { + const { subscribe, update } = writable({ + show: false, + component: null + }); + + return { + subscribe, + start: (component: typeof SvelteComponent) => + update((n) => { + n.show = true; + n.component = component; + + return n; + }), + hide: () => + update((n) => { + n.show = false; + n.component = null; + + return n; + }) + }; +} + +export const wizard = createWizardStore(); diff --git a/src/routes/console/+layout.svelte b/src/routes/console/+layout.svelte index d31f50a6b..cea54722f 100644 --- a/src/routes/console/+layout.svelte +++ b/src/routes/console/+layout.svelte @@ -13,6 +13,7 @@ import { page } from '$app/stores'; import { afterNavigate } from '$app/navigation'; import { onMount } from 'svelte'; + import { wizard } from '$lib/stores/wizard'; updateLayout({ title: $organization?.name ?? '', @@ -50,6 +51,10 @@