Skip to content

Commit e755c10

Browse files
committed
Added top buttons for better user experience if wanted. Styling improvements.
1 parent 58ec7f5 commit e755c10

File tree

6 files changed

+47
-4
lines changed

6 files changed

+47
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ npm install vue-stepper --save
2222
| :--------------- | :------- | :--------- |
2323
| `steps` | Array of Objects | Each object is a step that will be included in the stepper |
2424
| `locale` | String | Default: `en`. Current options: `en`, `es`. |
25+
| `top-buttons` | Boolean | Default: `false`. If `true` buttons on the header, at the start and the end of the steps, will be shown for better user experience. |
2526

2627

2728
### Steps object properties

demo/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<div class="container">
4242
<div class="columns">
4343
<div class="column is-8 is-offset-2">
44-
<horizontal-stepper :steps="demoSteps" @completed-step="completeStep"
44+
<horizontal-stepper :steps="demoSteps" @completed-step="completeStep" :top-buttons="true"
4545
@active-step="isStepActive" @stepper-finished="alert"></horizontal-stepper>
4646
</div>
4747
</div>

dist/build.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/build.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/HorizontalStepper.scss

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,30 @@
3333
@include shadow(1);
3434
min-height: 200px;
3535
.top {
36+
.stepper-button-top {
37+
z-index: 20;
38+
padding: .4rem;
39+
border-radius: 100rem;
40+
cursor: pointer;
41+
position: absolute;
42+
display: flex;
43+
align-items: center;
44+
justify-content: space-between;
45+
&.next {
46+
border: 2px solid #3383c8;
47+
color: #3383c8;
48+
right: 1%;
49+
&.deactivated {
50+
border: 2px solid #cccccc !important;
51+
color: #cccccc;
52+
cursor: not-allowed !important;
53+
}
54+
}
55+
&.previous {
56+
color: #333333;
57+
left: 1%;
58+
}
59+
}
3660
display: flex;
3761
align-items: center;
3862
position: relative;
@@ -63,6 +87,9 @@
6387
flex-direction: column;
6488
align-items: center;
6589
text-align: center;
90+
@include breakpoint(xs) {
91+
width: 100% !important;
92+
}
6693
&.deactivated {
6794
@include breakpoint(xs) {
6895
display: none;
@@ -72,6 +99,9 @@
7299
background-color: #bbbbbb !important;
73100
}
74101
}
102+
.step-title {
103+
opacity: .35;
104+
}
75105
}
76106
.circle {
77107
margin-bottom: 1rem;

src/HorizontalStepper.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22
<div class="stepper-box">
33
<div class="top">
44
<div class="divider-line"
5-
:style="{width: `${(100/(steps.length) * (steps.length - 1)) - 10}%`}"
5+
:style="{width: `${(100/(steps.length) * (steps.length - 1)) - 10}%`}"
66
></div>
77
<div class="steps-wrapper">
8+
<template v-if="topButtons">
9+
<div v-if="currentStep.index > 0" class="stepper-button-top previous" @click="backStep()">
10+
<i class="material-icons">keyboard_arrow_left</i>
11+
</div>
12+
</template>
813
<template v-for="(step, index) in steps">
914
<div :class="['step', isStepActive(index, step)]"
1015
:style="{width: `${100 / steps.length}%`}"
@@ -20,6 +25,9 @@
2025
</div>
2126
</div>
2227
</template>
28+
<div v-if="topButtons" :class="['stepper-button-top next', !canContinue ? 'deactivated' : '']" @click="nextStep()">
29+
<i class="material-icons">keyboard_arrow_right</i>
30+
</div>
2331
</div>
2432
</div>
2533
<div class="content">
@@ -61,6 +69,10 @@
6169
type: String,
6270
default: 'en'
6371
},
72+
topButtons: {
73+
type: Boolean,
74+
default: false
75+
},
6476
steps: {
6577
type: Array,
6678
default: function () {

0 commit comments

Comments
 (0)