-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathslds-brand-band.vue
114 lines (86 loc) · 3.12 KB
/
slds-brand-band.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
<template>
<div :class="brandBandClass"/>
</template>
<script lang="ts">
import { defineComponent } from "vue"
export default defineComponent({
name: "SldsBrandBand",
props: {
endColor: String,
groupPrivateTheme: Boolean,
groupPublicTheme: Boolean,
large: Boolean,
medium: Boolean,
noTheme: Boolean,
small: Boolean,
startColor: String,
userTheme: Boolean,
},
computed: {
/**
* The CSS class names for the brand band.
*/
brandBandClass(): string {
let classNames = "slds-brand-band"
// Brand band size
if (this.small) classNames += " slds-brand-band_small"
else if (this.large) classNames += " slds-brand-band_large"
else classNames += " slds-brand-band_medium"
// Brand band theme
if (this.noTheme) classNames += " slds-brand-band_none"
else if (this.userTheme) classNames += " slds-brand-band_user"
else if (this.groupPublicTheme) classNames += " slds-brand-band_group-public"
else if (this.groupPrivateTheme) classNames += " slds-brand-band_group-private"
else classNames += " slds-brand-band_default"
return classNames
},
},
watch: {
endColor() {
this.updateColors()
},
startColor() {
this.updateColors()
},
},
mounted() {
this.updateColors()
},
methods: {
updateColors(): void {
const startColorProperty = "--start-color"
const startColorValue = this.startColor ? this.startColor : "rgb(27, 95, 158)"
this.$el.style.setProperty(startColorProperty, startColorValue)
const endColorProperty = "--end-color"
const endColorValue = this.endColor ? this.endColor : "rgb(176, 196, 223)"
this.$el.style.setProperty(endColorProperty, endColorValue)
},
},
})
</script>
<style scoped lang="scss">
.slds-brand-band {
--start-color: rgb(27, 95, 158);
--end-color: rgb(176, 196, 223);
height: 0;
&:after {
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 60%, var(--end-color));
}
&.slds-brand-band_default:before {
background-image: url(../../assets/images/themes/oneSalesforce/banner-brand-default.png),
linear-gradient(to top, rgba(0, 0, 0, 0) 0, var(--start-color));
}
&.slds-brand-band_group-public:before {
background-image: url(../../assets/images/themes/oneSalesforce/banner-group-public-default.png),
linear-gradient(to top, rgba(0, 0, 0, 0) 0, var(--start-color));
}
&.slds-brand-band_group-private:before {
background-image: url(../../assets/images/themes/oneSalesforce/banner-group-private-default.png),
linear-gradient(to top, rgba(0, 0, 0, 0) 0, var(--start-color));
}
&.slds-brand-band_user:before {
background-image: url(../../assets/images/themes/oneSalesforce/banner-user-default.png),
linear-gradient(to top, rgba(0, 0, 0, 0) 0, var(--start-color));
}
}
</style>