-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathslds-text.vue
154 lines (124 loc) · 4.14 KB
/
slds-text.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
142
143
144
145
146
147
148
149
150
151
152
153
154
<template>
<div :class="textClassNames">
<slot/>
</div>
</template>
<script lang="ts">
import { defineComponent } from "vue"
export default defineComponent({
name: "SldsText",
props: {
/**
* Indicates whether the text is center aligned.
*/
alignCenter: Boolean,
/**
* Indicates whether the text is left aligned.
*/
alignLeft: Boolean,
/**
* Indicates whether the text is right aligned.
*/
alignRight: Boolean,
/**
* Indicates whether the text has the default color.
*/
default: Boolean,
/**
* Indicates whether the text has the destructive color.
*/
destructive: Boolean,
/**
* Indicates whether the text has the error color.
*/
error: Boolean,
/**
* Indicates whether the text has the heading large size.
*/
headingLarge: Boolean,
/**
* Indicates whether the text has the heading medium size.
*/
headingMedium: Boolean,
/**
* Indicates whether the text has the heading small size.
*/
headingSmall: Boolean,
/**
* Indicates whether the text has the inverse color.
*/
inverse: Boolean,
/**
* Indicates whether the text has the inverse weak color.
*/
inverseWeak: Boolean,
/**
* Indicates whether the text has the longform format.
*/
longForm: Boolean,
/**
* Indicates whether the text uses the monospaced font.
*/
monospace: Boolean,
/**
* Indicates whether the text has the body regular size.
*/
regular: Boolean,
/**
* Indicates whether the text has the body small size.
*/
small: Boolean,
/**
* Indicates whether the text has the success color.
*/
success: Boolean,
/**
* Indicates whether the text has the title size.
*/
title: Boolean,
/**
* Indicates whether the text has the title uppercase size.
*/
titleUppercase: Boolean,
/**
* Indicates whether the text has the weak color.
*/
weak: Boolean,
},
computed: {
/**
* The CSS class names for the text.
*/
textClassNames(): string {
let classNames = ""
// Text body
if (this.small) classNames += " slds-text-body_small"
else if (this.regular) classNames += " slds-text-body_regular"
// Text heading
if (this.headingLarge) classNames += " slds-text-heading_large"
else if (this.headingMedium) classNames += " slds-text-heading_medium"
else if (this.headingSmall) classNames += " slds-text-heading_small"
// Text title
if (this.title) classNames += " slds-text-title"
else if (this.titleUppercase) classNames += " slds-text-title_caps"
// Text long form
if (this.longForm) classNames += " slds-text-longform"
// Text alignment
if (this.alignLeft) classNames += " slds-text-align_left"
else if (this.alignRight) classNames += " slds-text-align_right"
else if (this.alignCenter) classNames += " slds-text-align_center"
// Text color
if (this.default) classNames += " slds-text-color_default"
else if (this.success) classNames += " slds-text-color_success"
else if (this.weak) classNames += " slds-text-color_weak"
else if (this.error) classNames += " slds-text-color_error"
else if (this.destructive) classNames += " slds-text-color_destructive"
else if (this.inverse) classNames += " slds-text-color_inverse"
else if (this.inverseWeak) classNames += " slds-text-color_inverse-weak"
// Text monospace
if (this.monospace) classNames += " slds-text-font_monospace"
return classNames
},
},
})
</script>