/
hero.vue
141 lines (139 loc) · 2.48 KB
/
hero.vue
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
<template functional>
<section :class="`hero is-medium hero-theme-${props.theme}`">
<opti-image
class="hero-bg-img"
:src="props.image"
:lazy="false"
:delay="100"
/>
<div class="hero-body">
<div class="container">
<h1 class="title animated fadeInUp">
{{ props.title }}
</h1>
<h2 class="subtitle animated fadeInUp slower">
{{ props.subtitle }}
</h2>
<br />
<div
v-if="slots().default"
class="under-subtitle animated fadeInDown slower"
>
<slot />
</div>
</div>
</div>
</section>
</template>
<script>
export default {
props: {
title: { type: String, default: '' },
subtitle: { type: String, default: '' },
image: { type: String, default: '' },
color: { type: String, default: '#469af0' },
theme: { type: String, default: 'mist' }
}
}
</script>
<style lang="scss" scoped>
.hero {
margin-top: 52px;
background-size: cover !important;
background-position: center;
text-align: center;
overflow: hidden;
position: relative;
}
.title {
font-weight: 300;
@media (min-width: 768px) {
font-size: 3.2rem;
}
}
.subtitle,
.under-subtitle {
padding: 0;
margin: 0;
}
.subtitle {
font-size: 1rem;
margin-bottom: 0 !important;
}
.under-subtitle {
display: inline-block;
font-size: 0.8rem;
border-top: 2px solid $primary;
padding-top: 5px;
}
.opti-image {
opacity: 0;
}
.opti-image-loaded {
opacity: 0.12;
animation: blurIn 4.5s ease;
}
</style>
<style lang="scss">
.hero {
.hero-bg-img {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
object-fit: cover;
width: 100%;
}
.opti-image {
opacity: 0;
}
.opti-image-loaded {
opacity: 1;
}
}
.hero-theme-mist {
.hero-bg-img {
filter: grayscale(1);
}
.opti-image-loaded {
opacity: 0.12;
animation: blurInGrayscale 4.5s ease;
}
}
.hero-theme-bold,
.hero-theme-light {
&.hero:after {
content: '';
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.65);
position: absolute;
}
.hero-body {
position: relative;
z-index: 2;
}
}
.hero-theme-bold {
.title,
.subtitle,
.under-subtitle,
.under-subtitle strong {
color: white;
}
}
.hero-theme-light.hero {
&:after {
background: rgba(255, 255, 255, 0.6);
}
.title,
.subtitle,
.under-subtitle,
.under-subtitle strong {
text-shadow: 1px 1px 2px white;
}
}
</style>