Skip to content

Commit e6b113f

Browse files
committed
add age selection to onboarding
1 parent 1e821e9 commit e6b113f

File tree

4 files changed

+40
-8
lines changed

4 files changed

+40
-8
lines changed

frontend/src/assets/css/tailwind.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,20 @@
355355
.onboarding-textarea:active, .onboarding-textarea:focus {
356356
outline: none;
357357
}
358+
359+
.onboarding-selection-button-container {
360+
@apply h-64;
361+
@apply pb-1;
362+
@apply my-8;
363+
@apply border-b-4;
364+
@apply max-w-xs;
365+
@apply border-white-matcha;
366+
@apply flex;
367+
@apply flex-col;
368+
@apply items-center;
369+
@apply w-full;
370+
@apply overflow-scroll;
371+
}
358372
}
359373

360374
@tailwind utilities;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<h1 class="text-gray-matcha">{{slide.current}} / {{slide.count}}</h1>
55
<h1 class="onboarding-sub-container-content-heading leading-none">{{slide.header}}</h1>
66
<p class="mt-2 text-gray-matcha">{{optionsSelectedCount}} / {{slide.maxOptionsForSelection}}</p>
7-
<div class="h-64 pb-1 my-8 border-b-4 max-w-xs border-white-matcha flex flex-col items-center w-full overflow-scroll">
7+
<div v-bind:class="{'onboarding-selection-button-container': true, 'justify-center': slide.options.length < 5}">
88
<SelectionButton v-for="(option, index) in slide.options" :key="index + option"
99
v-bind:val="option"
1010
v-bind:canBeSelected="canSelectMoreOptions"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<section class="onboarding-sub-container">
44
<h1 class="text-gray-matcha">{{slide.current}} / {{slide.count}}</h1>
55
<h1 class="onboarding-sub-container-content-heading leading-none">{{slide.header}}</h1>
6-
<div class="h-64 flex flex-col items-center justify-center w-full">
6+
<div v-bind:class="{'onboarding-selection-button-container': true, 'justify-center': slide.options.length < 5}">
77
<SelectionButton v-for="(option, index) in slide.options" :key="index + option"
88
v-bind:val="option"
99
v-bind:canBeSelected="true"

frontend/src/views/app/Onboarding.vue

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
v-bind:slide="{buttonText}"
66
v-on:nextSlide="nextSlide"
77
v-if="slideCurrent === 0"></Introduction>
8+
<SingleChoice
9+
v-bind:slide="{
10+
key: 'age',
11+
current: slideCurrent,
12+
count: slideCount,
13+
header: 'My age',
14+
options: generateAllowedAge(),
15+
buttonText}"
16+
v-on:saveInput="saveInput"
17+
v-if="slideCurrent === 1"></SingleChoice>
818
<SingleChoice
919
v-bind:slide="{
1020
key: 'gender',
@@ -14,7 +24,7 @@
1424
options: ['Male', 'Female', 'Other'],
1525
buttonText}"
1626
v-on:saveInput="saveInput"
17-
v-if="slideCurrent === 1"></SingleChoice>
27+
v-if="slideCurrent === 2"></SingleChoice>
1828
<SingleChoice
1929
v-bind:slide="{
2030
key: 'orientation',
@@ -24,7 +34,7 @@
2434
options: ['Heterosexual', 'Homosexual', 'Bi-sexual', 'Other'],
2535
buttonText}"
2636
v-on:saveInput="saveInput"
27-
v-if="slideCurrent === 2"></SingleChoice>
37+
v-if="slideCurrent === 3"></SingleChoice>
2838
<MultipleChoice
2939
v-bind:slide="{
3040
key: 'interests' ,
@@ -46,7 +56,7 @@
4656
maxOptionsForSelection: 10,
4757
buttonText}"
4858
v-on:saveInput="saveInput"
49-
v-if="slideCurrent === 3"></MultipleChoice>
59+
v-if="slideCurrent === 4"></MultipleChoice>
5060
<MainAndSecondaryImagesUpload
5161
v-bind:slide="{
5262
key: 'images',
@@ -58,7 +68,7 @@
5868
maxImagesAllowed: 5,
5969
buttonText}"
6070
v-on:saveInput="saveInput"
61-
v-if="slideCurrent === 4"></MainAndSecondaryImagesUpload>
71+
v-if="slideCurrent === 5"></MainAndSecondaryImagesUpload>
6272
<Textblock
6373
v-bind:slide="{
6474
key: 'bio',
@@ -69,11 +79,12 @@
6979
placeholder: 'I am best described as ...',
7080
buttonText}"
7181
v-on:saveInput="saveInput"
72-
v-if="slideCurrent === 5"></Textblock>
82+
v-if="slideCurrent === 6"></Textblock>
7383
</div>
7484
</template>
7585

7686
<script>
87+
/* eslint-disable */
7788
import Introduction from '@/components/app/onboarding/Introduction.vue';
7889
import SingleChoice from '@/components/app/onboarding/SingleChoice.vue';
7990
import MultipleChoice from '@/components/app/onboarding/MultipleChoice.vue';
@@ -90,7 +101,7 @@ export default {
90101
},
91102
data: () => ({
92103
slideCurrent: 0,
93-
slideCount: 5,
104+
slideCount: 6,
94105
userData: {},
95106
}),
96107
methods: {
@@ -108,6 +119,13 @@ export default {
108119
this.slideCurrent += 1;
109120
}
110121
},
122+
generateAllowedAge() {
123+
const ages = [];
124+
for (let i = 18; i < 100; i += 1) {
125+
ages.push(i);
126+
}
127+
return ages;
128+
},
111129
},
112130
computed: {
113131
buttonText() {

0 commit comments

Comments
 (0)