Skip to content

Commit 30880a7

Browse files
committed
Basic status label component (unused)
1 parent 2b3f5f8 commit 30880a7

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<template>
2+
<div :class="['status-label', getSlug()]">
3+
<div class="status-label-pip" :style="{ backgroundColor: getColor() }"></div>
4+
<div class="status-label-text">
5+
{{ label }}
6+
</div>
7+
</div>
8+
</template>
9+
10+
<script>
11+
export default {
12+
props: {
13+
label: {
14+
type: String,
15+
default: 'live',
16+
},
17+
color: {
18+
type: String,
19+
default: null,
20+
},
21+
},
22+
methods: {
23+
getSlug() {
24+
return this.label.toLowerCase().replace(/[^a-z]/, '-');
25+
},
26+
getColor() {
27+
if (!this.color) {
28+
return null;
29+
}
30+
31+
if (this.color.indexOf('#') !== 0) {
32+
return null;
33+
}
34+
35+
return this.color;
36+
},
37+
},
38+
};
39+
</script>
40+
41+
<style lang="postcss" scoped>
42+
.status-label {
43+
align-items: center;
44+
border-radius: 1em;
45+
display: inline-flex;
46+
height: 20px;
47+
padding: 0 10px 0 5px;
48+
49+
&.live {
50+
background-color: theme('colors.craft.green');
51+
}
52+
53+
&.pending {
54+
background-color: theme('colors.craft.orange');
55+
}
56+
}
57+
58+
.status-label-pip {
59+
background-color: white;
60+
border-radius: 100%;
61+
height: 12px;
62+
margin-right: 5px;
63+
width: 12px;
64+
}
65+
66+
.status-label-text {
67+
color: white;
68+
font-size: 0.7em;
69+
font-weight: 600;
70+
letter-spacing: 0.05em;
71+
text-transform: uppercase;
72+
}
73+
</style>

0 commit comments

Comments
 (0)