faq.vue
5.3 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<script setup>
import illustrationJohn from '@images/pages/illustration-john.png'
const faqSearchQuery = ref('')
const faqs = ref([])
const fetchFaqs = async () => {
const data = await $api('/pages/faq', { query: { q: faqSearchQuery.value } }).catch(err => console.log(err))
faqs.value = data
}
const activeTab = ref('Payment')
const activeQuestion = ref(1)
watch(activeTab, () => activeQuestion.value = 0)
watch(faqSearchQuery, fetchFaqs, { immediate: true })
const contactUs = [
{
icon: 'ri-phone-line',
via: '+ (810) 2548 2568',
tagLine: 'We are always happy to help!',
},
{
icon: 'ri-mail-line',
via: 'hello@help.com',
tagLine: 'Best way to get answer faster!',
},
]
</script>
<template>
<section>
<!-- 👉 Search -->
<AppSearchHeader
v-model="faqSearchQuery"
custom-class="mb-6"
>
<template #default>
<h4 class="text-h4 text-primary mb-3">
Hello, how can we help?
</h4>
<p class="text-body-1 mb-7">
or choose a category to quickly find the help you need
</p>
<!-- 👉 Search Input -->
<VTextField
placeholder="search articles..."
class="search-header-input mx-auto my-4"
>
<template #prepend-inner>
<VIcon
icon="ri-search-line"
size="18"
/>
</template>
</VTextField>
</template>
</AppSearchHeader>
<!-- 👉 Faq sections and questions -->
<VRow>
<VCol
v-show="faqs.length"
cols="12"
md="3"
sm="5"
class="position-relative"
>
<!-- 👉 Tabs -->
<VTabs
v-model="activeTab"
direction="vertical"
class="v-tabs-pill"
>
<VTab
v-for="faq in faqs"
:key="faq.faqTitle"
:value="faq.faqTitle"
>
<VIcon
:icon="faq.faqIcon"
start
/>
{{ faq.faqTitle }}
</VTab>
</VTabs>
<VImg
:src="illustrationJohn"
class="d-none d-sm-block mt-8"
/>
</VCol>
<VCol
cols="12"
md="9"
sm="7"
>
<!-- 👉 Windows -->
<VWindow
v-model="activeTab"
class="faq-v-window disable-tab-transition"
>
<VWindowItem
v-for="faq in faqs"
:key="faq.faqTitle"
:value="faq.faqTitle"
>
<div class="d-flex align-center mb-4 gap-x-4">
<VAvatar
rounded
color="primary"
variant="tonal"
size="50"
>
<VIcon
:size="30"
:icon="faq.faqIcon"
/>
</VAvatar>
<div>
<h5 class="text-h5">
{{ faq.faqTitle }}
</h5>
<div class="text-body-1">
{{ faq.faqSubtitle }}
</div>
</div>
</div>
<VExpansionPanels
v-model="activeQuestion"
multiple
>
<VExpansionPanel
v-for="item in faq.faqs"
:key="item.question"
:title="item.question"
:text="item.answer"
/>
</VExpansionPanels>
</VWindowItem>
</VWindow>
</VCol>
<VCol
v-show="!faqs.length"
cols="12"
:class="!faqs.length ? 'd-flex justify-center align-center' : ''"
>
<VIcon
icon="ri-question-line"
start
size="20"
/>
<span class="text-base font-weight-medium">
No Results Found!!
</span>
</VCol>
</VRow>
<!-- 👉 You still have a question? -->
<div class="text-center mt-6">
<div class="py-6">
<VChip
color="primary"
size="small"
>
Question
</VChip>
<h4 class="text-h4 my-2">
You still have a question?
</h4>
<p class="text-body-1 mb-0">
If you cannot find a question in our FAQ, you can always contact us. We will answer to you shortly!
</p>
</div>
<!-- contacts -->
<VRow class="mt-3">
<VCol
v-for="contact in contactUs"
:key="contact.icon"
sm="6"
cols="12"
>
<VCard
flat
color="rgba(var(--v-theme-on-surface), var(--v-hover-opacity))"
>
<VCardText class="pa-6">
<VAvatar
rounded
color="primary"
variant="tonal"
size="50"
class="mb-4"
>
<VIcon
:icon="contact.icon"
size="30"
/>
</VAvatar>
<h5 class="text-h5 mb-1">
{{ contact.via }}
</h5>
<div class="text-body-1">
{{ contact.tagLine }}
</div>
</VCardText>
</VCard>
</VCol>
</VRow>
</div>
</section>
</template>
<style lang="scss">
.faq-v-window {
.v-window__container {
z-index: 0;
}
}
</style>