/
SidebarButton.vue
99 lines (97 loc) · 1.94 KB
/
SidebarButton.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
<template>
<a
class="sidebar-button"
:class="[type.toLowerCase(), activeView.includes(id) ? 'active' : '']"
href="#"
:data-title="!activeView.includes(id) ? tooltip : null"
@click="$emit('button-action', id)"
>
<!-- <svgicon
v-if="type !== 'Refresh'"
v-show="activeView.includes(id)"
class="sidebar-button__icon-help"
:name="type === 'Mode' ? 'check3' : 'double-chev'"
></svgicon> -->
<svgicon :name="icon"></svgicon>
</a>
</template>
<script>
import "assets/icons/refresh";
import "assets/icons/explore-view";
import "assets/icons/annotate-view";
import "assets/icons/labelling-rules-view";
import "assets/icons/progress";
import "assets/icons/metrics";
export default {
props: {
activeView: {
type: Array,
default: () => [],
},
tooltip: {
type: String,
required: true,
},
id: {
type: String,
required: true,
},
icon: {
type: String,
required: true,
},
type: {
type: String,
required: true,
validator: (value) => {
return ["Mode", "Metrics", "Refresh"].includes(value);
},
},
},
};
</script>
<style lang="scss" scoped>
$color: #333346;
.sidebar-button {
&__icon-help {
left: 5px;
width: 11px !important;
margin-right: 0;
stroke-width: 2;
position: absolute;
left: 0.8em;
}
&.active {
&.mode {
.svg-icon {
background: palette(grey, smooth);
border-radius: $border-radius;
}
}
&.metrics {
position: relative;
&:before {
content: "";
height: 38px;
width: 2px;
background: $color;
border-radius: 2px;
position: absolute;
left: 0;
top: 0;
}
}
}
}
.svg-icon {
display: block;
text-align: center;
margin: auto;
width: 24px;
height: 24px;
fill: $color;
padding: 0.5em;
box-sizing: content-box;
margin-bottom: 0.5em;
}
</style>