-
-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathSelectionStep.vue
94 lines (91 loc) · 2.51 KB
/
SelectionStep.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<template>
<div class="selection-step">
<p class="selection-question">{{ this.$t(question) }}</p>
<div class="field" :class="yesSelected">
<b-radio v-model="radio"
native-value="yes">
<span v-html="$t(yesText)" />
</b-radio>
</div>
<div class="field" :class="noSelected">
<b-radio v-model="radio"
native-value="no">
<span v-html="$t(noText)" />
</b-radio>
</div>
</div>
</template>
<script>
export default {
name: 'SelectionStep',
props: ['selected', 'stepId'],
computed: {
radio: {
get() {
return this.$props.selected ? 'yes' : 'no'
},
set(newVal) {
const returnValue = newVal === 'yes'
this.$emit('input', { selected: returnValue, stepId: this.stepId })
}
},
question() {
return `stepper-question.${this.stepId.toLowerCase()}`
},
yesText() {
return `stepper-description.${this.stepId.toLowerCase()}.selected`
},
noText() {
return `stepper-description.${this.stepId.toLowerCase()}.not-selected`
},
yesSelected() {
if (this.$props.selected) {
return 'selected'
} else {
return 'not-selected'
}
},
noSelected() {
if (!this.$props.selected) {
return 'selected'
} else {
return 'not-selected'
}
}
}
}
</script>
<style lang="scss" scoped>
.selection-question {
margin-bottom: 2rem;
font-weight: bold;
font-style: normal;
font-size: 20px;
line-height: 26px;
color: #333333;
}
.field {
padding: 1rem;
margin-bottom: 0;
}
.field.not-selected {
opacity: 0.7;
}
.field:hover {
box-shadow: 0 10px 15px -3px rgba(237, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
-webkit-transform: scale(0.98);
-ms-transform: scale(.98);
transform: scale(.98);
border: 1px solid rgba(237,89,47, 0.5);
border-radius: 5px;
}
.field:active {
color: #ED592F;
}
.step-content {
height: 285px;
}
.step-navigation {
text-align: center;
}
</style>