AppSearchHeader.vue
1.72 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
<script setup>
import AppSearchHeaderBgDark from '@images/pages/app-search-header-bg-dark.png'
import AppSearchHeaderBgLight from '@images/pages/app-search-header-bg-light.png'
const props = defineProps({
title: {
type: String,
required: false,
},
subtitle: {
type: String,
required: false,
},
customClass: {
type: String,
required: false,
},
placeholder: {
type: String,
required: false,
default: 'Ask a question..',
},
})
defineOptions({
inheritAttrs: false,
})
const themeBackgroundImg = useGenerateImageVariant(AppSearchHeaderBgLight, AppSearchHeaderBgDark)
</script>
<template>
<!-- 👉 Search Banner -->
<VCard
flat
class="text-center search-header"
:class="customClass"
:style="`background: url(${themeBackgroundImg});`"
>
<VCardText>
<slot>
<h4 class="text-h4 text-primary">
{{ title }}
</h4>
<!-- 👉 Search Input -->
<VTextField
v-bind="$attrs"
:placeholder="placeholder"
class="search-header-input mx-auto my-4"
>
<template #prepend-inner>
<VIcon
icon="ri-search-line"
size="18"
/>
</template>
</VTextField>
<p class="text-body-1">
{{ subtitle }}
</p>
</slot>
</VCardText>
</VCard>
</template>
<style lang="scss">
.search-header {
padding: 4rem !important;
background-size: cover !important;
}
// search input
.search-header-input {
border-radius: 0.25rem !important;
background-color: rgb(var(--v-theme-surface));
max-inline-size: 32.125rem;
}
@media (max-width: 37.5rem) {
.search-header {
padding: 1.5rem !important;
}
}
</style>