Skip to content

Commit 9dab38b

Browse files
committed
sort and filter UI finalized
1 parent 0b996c3 commit 9dab38b

File tree

5 files changed

+66
-12
lines changed

5 files changed

+66
-12
lines changed

frontend/src/assets/css/tailwind.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@
399399
}
400400

401401
.sort-dropdown {
402-
@apply w-56;
402+
@apply w-auto;
403403
@apply h-56;
404404
@apply mt-4;
405405
@apply overflow-scroll;
@@ -413,8 +413,7 @@
413413
.sort-dropdown-option {
414414
@apply cursor-pointer;
415415
@apply block;
416-
@apply pl-4;
417-
@apply py-4;
416+
@apply p-4;
418417
@apply text-sm;
419418
@apply leading-5;
420419
@apply text-gray-700;

frontend/src/components/app/recommendations/Recommendations.vue

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
11
<template>
22
<!-- eslint-disable max-len -->
33
<section>
4-
<h1 class="text-5xl my-4 text-center sm:text-left leading-none onboarding-sub-container-content-heading">{{recommendations.length}} {{title}}</h1>
5-
<div class="flex w-full items-stretch sm:items-center justify-center sm:justify-start mb-12 relative">
4+
<h1 class="text-5xl my-4 text-center md:text-left leading-none onboarding-sub-container-content-heading">{{recommendations.length}} {{title}}</h1>
5+
<div class="flex w-full items-stretch sm:items-center justify-center md:justify-start mb-12 relative">
66
<Sort
7-
v-bind:options="['Youngest', 'Oldest', 'Closest', 'Farest', 'Most popular', 'Least popular', 'Most common interests', 'Least common interests']"
7+
v-bind:position="'left'"
8+
v-bind:options="['Youngest', 'Oldest', 'Closest', 'Furthest', 'Most popular', 'Least popular', 'Most common interests', 'Least common interests']"
89
v-on:sort="sort"></Sort>
910
<FilterSlider v-bind:name="'age'" v-on:filter="filter"></FilterSlider>
1011
<FilterSlider v-bind:unit="'km'" v-bind:name="'distance'" v-on:filter="filter"></FilterSlider>
1112
<FilterSlider v-bind:unit="'pts'" v-bind:name="'fame'" v-on:filter="filter"></FilterSlider>
12-
<FilterSlider v-bind:name="'tags'" v-on:filter="filter"></FilterSlider>
13+
<MultipleFiltersDropdown
14+
v-bind:position="'right'"
15+
v-bind:options="[
16+
'swimming', 'wine', 'reading', 'foodie', 'netflix', 'music', 'yoga', 'golf',
17+
'photography', 'baking', 'shopping', 'outdoors', 'art', 'travel', 'hiking',
18+
'running', 'volunteering', 'cycling', 'climbing', 'tea', 'fishing', 'soccer',
19+
'museum', 'dancing', 'surfing', 'karaoke', 'parties', 'diy',
20+
'walking', 'cat lover', 'movies', 'gardening', 'trivia', 'working out',
21+
'cooking', 'gamer', 'brunch', 'blogging', 'picknicking', 'athlete',
22+
'dog lover', 'politics', 'environmentalism', 'instagram', 'spirituality',
23+
'language exchange', 'sports', 'comedy', 'fashion', 'disney', 'vlogging',
24+
'astrology', 'board games', 'craft beer', 'coffee', 'writer',
25+
]"
26+
v-bind:name="'interests'"
27+
v-on:filter="filter"></MultipleFiltersDropdown>
1328
</div>
1429
<!-- <div class="flex flex-wrap items-center justify-start">-->
1530
<div class="grid grid-cols-1 md:grid-cols-2 gap-2">
@@ -25,12 +40,14 @@
2540
import Sort from '@/components/shared/Sort.vue';
2641
import FilterSlider from '@/components/shared/FilterSlider.vue';
2742
import RecommendationCard from '@/components/app/recommendations/RecommendationCard.vue';
43+
import MultipleFiltersDropdown from '@/components/shared/MultipleFiltersDropdown.vue';
2844
2945
export default {
3046
components: {
3147
Sort,
3248
RecommendationCard,
3349
FilterSlider,
50+
MultipleFiltersDropdown,
3451
},
3552
methods: {
3653
sort() {

frontend/src/components/shared/FilterSlider.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<h1 v-bind:class="{ 'opacity-50': closed, 'noSelect': true, 'capitalize': true }">{{name}}</h1>
66
</div>
77
<div ref="sliderDropdown" v-bind:class="{'slider-dropdown': true, 'hidden': closed}">
8-
<div class="flex my-4">
8+
<div class="flex mb-4 mt-2">
99
<h1><span class="font-bold">{{this.slider.startMin}} {{this.unit}}</span> to <span class="font-bold">{{this.slider.startMax}} {{this.unit}}</span></h1>
1010
</div>
1111
<div ref="slider" class="w-64 mb-4"></div>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<template>
2+
<!-- eslint-disable max-len -->
3+
<div class="focus:outline-none ml-2 flex-1 sm:flex-none" @focusout="close" tabindex="0">
4+
<div v-bind:class="{'filter-button': true, 'border-gray-matcha': !closed}" @click="toggle">
5+
<h1 v-bind:class="{ 'opacity-50': closed, 'noSelect': true, 'capitalize': true }">{{name}}</h1>
6+
</div>
7+
<div v-bind:class="{'sort-dropdown': true, 'hidden': closed, 'right-0': position === 'right', 'md:right-auto': position === 'right'}">
8+
<h1 v-for="(option, index) in options" :key="option + index + option"
9+
v-bind:class="{'sort-dropdown-option': true, 'border-b': index !== options.length - 1, 'capitalize': true}"
10+
v-on:click="select(option)">
11+
{{option}}
12+
</h1>
13+
</div>
14+
</div>
15+
</template>
16+
17+
<script>
18+
export default {
19+
props: ['options', 'name', 'position'],
20+
data: () => ({
21+
closed: true,
22+
selectedFilters: [],
23+
}),
24+
methods: {
25+
select(option) {
26+
this.selectedFilters.push(option);
27+
this.$emit('sort', option);
28+
},
29+
toggle() {
30+
this.closed = !this.closed;
31+
},
32+
close() {
33+
this.closed = true;
34+
},
35+
},
36+
};
37+
</script>

frontend/src/components/shared/Sort.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
<!-- eslint-disable max-len -->
33
<div class="focus:outline-none flex-1 sm:flex-none" @focusout="close" tabindex="0">
44
<div v-bind:class="{'sort-button': true, 'border-gray-matcha': !closed}" @click="toggle">
5-
<!-- <img v-bind:class="{ 'opacity-50': closed, 'noSelect': true }" src="../../assets/sort.png">-->
65
<h1 v-bind:class="{ 'opacity-50': closed, 'noSelect': true, 'capitalize': true }">↑↓</h1>
76
</div>
8-
<div v-bind:class="{'sort-dropdown': true, 'hidden': closed}">
7+
<div v-bind:class="{'sort-dropdown': true, 'hidden': closed, 'left-0': position === 'left', 'md:left-auto': position === 'left'}">
98
<h1 v-for="(option, index) in options" :key="option + index + option"
10-
v-bind:class="{'sort-dropdown-option': true, 'border-b': index !== options.length - 1}"
9+
v-bind:class="{'sort-dropdown-option': true, 'border-b': index !== options.length - 1, 'font-bold': option === currentOption}"
1110
v-on:click="select(option)">
1211
{{option}}
1312
</h1>
@@ -17,13 +16,15 @@
1716

1817
<script>
1918
export default {
20-
props: ['options', 'name'],
19+
props: ['options', 'name', 'position'],
2120
data: () => ({
2221
closed: true,
22+
currentOption: '',
2323
}),
2424
methods: {
2525
select(option) {
2626
this.closed = true;
27+
this.currentOption = option;
2728
this.$emit('sort', option);
2829
},
2930
toggle() {

0 commit comments

Comments
 (0)