forked from gardener/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGTeaser.vue
128 lines (117 loc) · 2.64 KB
/
GTeaser.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
<!--
SPDX-FileCopyrightText: 2023 SAP SE or an SAP affiliate company and Gardener contributors
SPDX-License-Identifier: Apache-2.0
-->
<template>
<div
class="g-teaser bg-main-background-darken-2"
:style="{
height: `${teaserHeight}px`,
}"
>
<slot />
<!-- eslint-disable vue/no-v-html -->
<div
v-if="teaserTemplate"
v-html="teaserHtml"
/>
<!-- eslint-enable vue/no-v-html -->
<div
v-else
class="g-teaser__content"
>
<div class="text-center mt-6">
<a
href="/"
class="text-decoration-none"
>
<img
:src="branding.productLogoUrl"
height="80"
:alt="`${branding.productName} Logo`"
class="pointer-events-none"
>
<div
v-if="branding.productTitle"
class="g-teaser-title text-main-navigation-title"
>
{{ branding.productTitle }}
<sup
v-if="branding.productTitleSuperscript"
class="text-truncate"
>
{{ branding.productTitleSuperscript }}
</sup>
</div>
<div
v-if="branding.productSlogan"
class="g-teaser-subtitle text-primary"
>
{{ branding.productSlogan }}
</div>
</a>
</div>
</div>
</div>
</template>
<script>
import { mapState } from 'pinia'
import { useConfigStore } from '@/store/config'
import { omitKeysWithSuffix } from '@/utils'
import { template } from '@/lodash'
export default {
computed: {
...mapState(useConfigStore, [
'branding',
]),
teaserTemplate () {
return this.branding.teaserTemplate
},
compiledTeaserTemplate () {
return template(this.teaserTemplate, {
interpolate: /{{([\s\S]+?)}}/g,
})
},
teaserHtml () {
const data = omitKeysWithSuffix(this.branding, 'Template')
return this.compiledTeaserTemplate(data)
},
teaserHeight () {
return this.branding.teaserHeight ?? 200
},
},
}
</script>
<style lang="scss">
.g-teaser {
overflow: hidden;
.g-teaser__content {
overflow: hidden;
}
.g-teaser-title {
font-size: 40px;
font-weight: 100;
line-height: 40px;
letter-spacing: 4px;
padding-top: 8px;
margin: 0;
position: relative;
}
.g-teaser-title > sup {
font-size: 10px;
letter-spacing: 2px;
line-height: 10px;
position: absolute;
top: 2px;
right: 16px;
max-width: 70%;
}
.g-teaser-subtitle {
font-size: 15px;
font-weight: 300;
letter-spacing: 0.8px;
padding: 0;
margin: 0;
}
}
</style>