Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Commit

Permalink
Add slots to WizardStep
Browse files Browse the repository at this point in the history
  • Loading branch information
cristijora committed Jul 31, 2017
1 parent 81b6950 commit 77a16bb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
9 changes: 7 additions & 2 deletions dev-example/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class="card" ref="wizard">
<template slot="step" scope="props">
<wizard-step :tab="props.tab"
:transition="props.transition"
transition="fade"
:key="props.tab.title"
:index="props.index">
</wizard-step>
Expand Down Expand Up @@ -103,5 +103,10 @@
position: relative;
z-index: 1;
}
.fade-enter-active, .fade-leave-active {
transition: opacity .2s
}
.fade-enter, .fade-leave-to /* .fade-leave-active in <2.1.8 */ {
opacity: 0
}
</style>
1 change: 0 additions & 1 deletion src/components/FormWizard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<wizard-step :tab="tab"
@click.native="navigateToTab(index)"
:transition="transition"
:key="tab.title"
:index="index">
</wizard-step>
</slot>
Expand Down
31 changes: 19 additions & 12 deletions src/components/WizardStep.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,29 @@
:style="[tab.checked ? stepCheckedStyle : {}, tab.validationError ? errorStyle : {}]">

<transition :name="transition" mode="out-in">
<div v-if="tab.active" class="wizard-icon-container"
:class="{square_shape:isStepSquare, tab_shape:isTabShape}"
:style="[tab.active ? iconActiveStyle: {}, tab.validationError ? errorStyle : {}]">
<i v-if="tab.icon" :class="tab.icon" class="wizard-icon"></i>
<i v-else class="wizard-icon">{{index + 1}}</i>
</div>
<i v-if="!tab.active && tab.icon" :class="tab.icon" class="wizard-icon"></i>
<i v-if="!tab.active && !tab.icon" class="wizard-icon">{{index + 1}}</i>

<div v-if="tab.active" class="wizard-icon-container"
:class="{square_shape:isStepSquare, tab_shape:isTabShape}"
:style="[tab.active ? iconActiveStyle: {}, tab.validationError ? errorStyle : {}]">
<slot name="active-step">
<i v-if="tab.icon" :class="tab.icon" class="wizard-icon"></i>
<i v-else class="wizard-icon">{{index + 1}}</i>
</slot>
</div>
<slot v-if="!tab.active">
<i v-if="!tab.active && tab.icon" :class="tab.icon" class="wizard-icon"></i>
<i v-if="!tab.active && !tab.icon" class="wizard-icon">{{index + 1}}</i>
</slot>
</transition>

</div>
<span class="stepTitle"
:class="{active:tab.active, has_error:tab.validationError}"
:style="tab.active ? stepTitleStyle : {}">
<slot name="title">
<span class="stepTitle"
:class="{active:tab.active, has_error:tab.validationError}"
:style="tab.active ? stepTitleStyle : {}">
{{tab.title}}
</span>
</span>
</slot>
</a>
</li>
</template>
Expand Down

0 comments on commit 77a16bb

Please sign in to comment.