mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
feat: optional steps are skippable now
This commit is contained in:
1 parent
b5b70d2918
commit
f78c5dd64f
4 files changed
+20
-4
No files matched your search
@@ -9,7 +9,7 @@
|
||||
<li
|
||||
class:steps-item={!isSub}
|
||||
class:steps-sub-item={isSub}
|
||||
aria-label={` ${completed ? 'done' : current ? 'current' : ''} step`}>
|
||||
aria-label={`${completed ? 'done' : current ? 'current' : ''} step`}>
|
||||
{#if isSub}
|
||||
<span class="text">{step.text}</span>
|
||||
{:else}
|
||||
|
||||
@@ -3,18 +3,26 @@
|
||||
|
||||
export let steps: {
|
||||
text: string;
|
||||
optional: boolean;
|
||||
substeps?: {
|
||||
text: string;
|
||||
}[];
|
||||
}[];
|
||||
export let currentStep = 1;
|
||||
export let currentSub = 1;
|
||||
|
||||
$: firstOptional = steps.findIndex((step) => step.optional);
|
||||
|
||||
//TODO: remove inline styling
|
||||
</script>
|
||||
|
||||
<ol class="steps">
|
||||
{#if steps}
|
||||
{#each steps as step, index}
|
||||
{@const stepNumber = index + 1}
|
||||
{#if firstOptional === index}
|
||||
<span style="margin-block: 1.5rem;">OPTIONAL</span>
|
||||
{/if}
|
||||
<Step
|
||||
bind:currentSub
|
||||
current={currentStep === stepNumber}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
{
|
||||
label: string;
|
||||
component: typeof SvelteComponent;
|
||||
optional?: boolean;
|
||||
}
|
||||
>;
|
||||
</script>
|
||||
@@ -70,8 +71,10 @@
|
||||
|
||||
<aside class="wizard-side">
|
||||
<Steps
|
||||
steps={sortedSteps.map(([, { label }]) => ({
|
||||
text: label
|
||||
on:step={submit}
|
||||
steps={sortedSteps.map(([, { label, optional }]) => ({
|
||||
text: label,
|
||||
optional
|
||||
}))}
|
||||
{currentStep} />
|
||||
</aside>
|
||||
@@ -87,6 +90,10 @@
|
||||
{/each}
|
||||
<div class="form-footer">
|
||||
<div class="u-flex u-main-end u-gap-12">
|
||||
{#if sortedSteps[currentStep - 1][1].optional}
|
||||
<Button text on:click={() => (isLastStep = true)} submit
|
||||
>Skip optional steps</Button>
|
||||
{/if}
|
||||
{#if currentStep === 1}
|
||||
<Button secondary on:click={wizard.hide}>Cancel</Button>
|
||||
<Button submit>Next</Button>
|
||||
|
||||
+2
-1
@@ -72,7 +72,8 @@
|
||||
});
|
||||
stepsComponents.set(2, {
|
||||
label: 'Set permissions',
|
||||
component: Step2
|
||||
component: Step2,
|
||||
optional: true
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in new issue
Block a user