Skip to content

Commit

Permalink
Merge pull request #1203 from PrefectHQ/wiz-foot
Browse files Browse the repository at this point in the history
Enhancement: Add a footer slot to the wizard component
  • Loading branch information
zhen0 authored Apr 13, 2024
2 parents 14c63d3 + 9b388c1 commit b6a5e3b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/Wizard/PWizard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<slot name="after-steps" />

<div class="p-wizard__footer">
<div class="p-wizard__actions">
<slot name="actions" :next-button-text="nextButtonText" :handle-next-button-click="handleNextButtonClick">
<template v-if="showCancel">
<p-button @click="emit('cancel')">
Expand All @@ -36,6 +36,7 @@
</p-button>
</slot>
</div>
<slot name="footer" />
</PCard>
</div>
</template>
Expand All @@ -60,6 +61,7 @@
const emit = defineEmits<{
(event: 'cancel' | 'next' | 'previous' | 'submit'): void,
(event: 'step', currentStepIndex: WizardStep | undefined): void,
}>()
const {
Expand Down Expand Up @@ -100,6 +102,7 @@
const { success } = await previous()
if (success) {
emit('step', currentStep.value)
emit('previous')
}
}
Expand All @@ -109,9 +112,11 @@
const { success } = await next()
if (success) {
emit('step', currentStep.value)
emit('next')
if (last) {
emit('step', currentStep.value)
emit('submit')
}
}
Expand All @@ -134,7 +139,7 @@
pb-6
}
.p-wizard__footer { @apply
.p-wizard__actions { @apply
flex
flex-wrap
gap-2
Expand Down

0 comments on commit b6a5e3b

Please sign in to comment.