Skip to content

Commit 01ea98d

Browse files
committed
fixed more than max selections in slide 3
1 parent 97fd608 commit 01ea98d

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

frontend/src/components/app/onboarding/SelectionButton.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44
'onboarding-sub-container-content-button-outline': true,
55
'mt-2': true,
66
'onboarding-sub-container-content-button-outline-selected': selected,
7+
'cursor-default': invalid,
78
}"
89
v-on:click="select(val)">{{val}}</h1>
910
</template>
1011

1112
<script>
13+
/* eslint-disable max-len */
14+
1215
export default {
1316
props: ['val', 'bus'],
1417
data: () => ({
@@ -17,6 +20,9 @@ export default {
1720
}),
1821
methods: {
1922
select(val) {
23+
if (!this.selected && this.$parent.maxInterests && this.$parent.optionSelected.length === this.$parent.maxInterests) {
24+
return;
25+
}
2026
if (this.selected) {
2127
this.selected = false;
2228
this.selectedValue = '';
@@ -33,6 +39,11 @@ export default {
3339
}
3440
},
3541
},
42+
computed: {
43+
invalid() {
44+
return !this.selected && this.$parent.maxInterests && this.$parent.optionSelected.length === this.$parent.maxInterests;
45+
},
46+
},
3647
mounted() {
3748
this.bus.$on('deselectIfNot', this.deselectIfNot);
3849
},

frontend/src/components/app/onboarding/SlideThree.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ export default {
5050
this.$emit('saveInput', 'slideThree', this.optionSelected, 0);
5151
},
5252
select(...args) {
53-
const [val] = args;
54-
this.optionSelected.push(val);
53+
if (this.optionSelected.length < this.maxInterests) {
54+
const [val] = args;
55+
this.optionSelected.push(val);
56+
}
5557
},
5658
deselect(val) {
5759
this.optionSelected = this.optionSelected.filter((e) => e !== val);

0 commit comments

Comments
 (0)