|
@@ -5,9 +5,9 @@
|
5
|
5
|
<div class="category">
|
6
|
6
|
<h5 class="mb-3">Categories</h5>
|
7
|
7
|
<div class="d-flex gap-3 category-list">
|
8
|
|
- <button v-for="item in categories" :key="item.id" class="btn btn-outline-dark"
|
9
|
|
- :class="{ active: selectedCategories === item.id }" v-html="item.name"
|
10
|
|
- @click="selectedCategories = item.id"></button>
|
|
8
|
+ <button v-for="category in categories" :key="category.id" class="btn btn-outline-dark"
|
|
9
|
+ :class="{ active: selectedCategories === category.id }" v-html="category.title"
|
|
10
|
+ @click="selectCategory(category)"></button>
|
11
|
11
|
</div>
|
12
|
12
|
</div>
|
13
|
13
|
<MenuContainer />
|
|
@@ -20,8 +20,10 @@
|
20
|
20
|
</template>
|
21
|
21
|
|
22
|
22
|
<script>
|
|
23
|
+import { ref } from 'vue';
|
23
|
24
|
import MenuContainer from '../components/MenuContainer.vue';
|
24
|
25
|
import OrderList from '../components/OrderList.vue';
|
|
26
|
+import { useMenuStore } from '../stores/menus';
|
25
|
27
|
|
26
|
28
|
export default {
|
27
|
29
|
components: {
|
|
@@ -33,31 +35,51 @@ export default {
|
33
|
35
|
categories: [
|
34
|
36
|
{
|
35
|
37
|
id: 1,
|
36
|
|
- name: '🥘 All Menu'
|
|
38
|
+ value: 'all',
|
|
39
|
+ title: '🥘 All Menu'
|
37
|
40
|
},
|
38
|
41
|
{
|
39
|
42
|
id: 2,
|
40
|
|
- name: '☕ Coffee'
|
|
43
|
+ value: 'coffee',
|
|
44
|
+ title: '☕ Coffee'
|
41
|
45
|
},
|
42
|
46
|
{
|
43
|
47
|
id: 3,
|
44
|
|
- name: '🍫 Chocolate'
|
|
48
|
+ value: 'tea',
|
|
49
|
+ title: '🧋 Tea'
|
45
|
50
|
},
|
46
|
51
|
{
|
47
|
52
|
id: 4,
|
48
|
|
- name: '🍟 Snacks'
|
|
53
|
+ value: 'chocolate',
|
|
54
|
+ title: '🍫 Chocolate'
|
49
|
55
|
},
|
50
|
56
|
{
|
51
|
57
|
id: 5,
|
52
|
|
- name: '🍨 Ice Cream'
|
|
58
|
+ value: 'snacks',
|
|
59
|
+ title: '🍟 Snacks'
|
53
|
60
|
},
|
54
|
|
- ],
|
55
|
|
- selectedCategories: 1
|
|
61
|
+ {
|
|
62
|
+ id: 6,
|
|
63
|
+ value: 'ice cream',
|
|
64
|
+ title: '🍨 Ice Cream'
|
|
65
|
+ },
|
|
66
|
+ ]
|
56
|
67
|
}
|
57
|
68
|
}
|
58
|
69
|
}
|
59
|
70
|
</script>
|
60
|
71
|
|
|
72
|
+<script setup>
|
|
73
|
+const { getMenuPerCategory } = useMenuStore()
|
|
74
|
+
|
|
75
|
+let selectedCategories = ref(1)
|
|
76
|
+
|
|
77
|
+const selectCategory = (category) => {
|
|
78
|
+ selectedCategories.value = category.id;
|
|
79
|
+ getMenuPerCategory(category.value)
|
|
80
|
+}
|
|
81
|
+</script>
|
|
82
|
+
|
61
|
83
|
<style lang="scss" scoped>
|
62
|
84
|
.menu {
|
63
|
85
|
padding: 28px 8px 0 32px;
|
|
@@ -75,15 +97,29 @@ export default {
|
75
|
97
|
}
|
76
|
98
|
|
77
|
99
|
.category {
|
78
|
|
- margin-bottom: 30px;
|
|
100
|
+ margin-bottom: 20px;
|
79
|
101
|
|
80
|
102
|
.category-list {
|
|
103
|
+ overflow-x: auto;
|
|
104
|
+ padding-bottom: 10px;
|
|
105
|
+
|
|
106
|
+ &::-webkit-scrollbar {
|
|
107
|
+ height: 5px;
|
|
108
|
+ // background-color: #f5f5f5;
|
|
109
|
+ }
|
|
110
|
+
|
|
111
|
+ &::-webkit-scrollbar-thumb {
|
|
112
|
+ border-radius: 10px;
|
|
113
|
+ background-color: transparent;
|
|
114
|
+ }
|
|
115
|
+
|
81
|
116
|
.btn {
|
82
|
117
|
border-radius: 50px;
|
83
|
118
|
padding: 8px 16px;
|
84
|
119
|
border-color: #5C5470;
|
85
|
120
|
color: #5C5470;
|
86
|
121
|
font-size: 14px;
|
|
122
|
+ white-space: nowrap;
|
87
|
123
|
|
88
|
124
|
&:hover {
|
89
|
125
|
background: linear-gradient(232deg, rgba(185, 138, 238, 0.80) 0%, rgba(251, 190, 222, 0.80) 100%);
|