-
Notifications
You must be signed in to change notification settings - Fork 634
/
HeaderTab.vue
100 lines (86 loc) · 1.97 KB
/
HeaderTab.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
<template>
<router-link
ref="btn"
:to="to"
class="header-tab"
:activeClass="activeClasses"
:style="{ color: $coreTextAnnotation }"
:class="defaultStyles"
>
<div class="inner" :style="{ borderColor: this.$coreActionNormal }">
{{ text }}
</div>
</router-link>
</template>
<script>
import themeMixin from 'kolibri.coreVue.mixins.themeMixin';
export default {
name: 'HeaderTab',
mixins: [themeMixin],
props: {
text: {
type: String,
required: true,
},
to: {
type: Object,
required: true,
},
},
computed: {
activeClasses() {
// return both fixed and dynamic classes
return `router-link-active ${this.$computedClass({ color: this.$coreActionNormal })}`;
},
defaultStyles() {
return this.$computedClass({
':focus': this.$coreOutline,
':hover': {
backgroundColor: this.$coreGrey300,
},
});
},
},
};
</script>
<style lang="scss" scoped>
@import '~kolibri.styles.definitions';
// a lot copied from KButton
.header-tab {
position: relative;
top: 9px;
display: inline-table; // helps with vertical layout
min-width: 64px;
max-width: 100%;
min-height: 36px;
margin: 8px;
overflow: hidden;
font-size: 14px;
font-weight: bold;
line-height: 36px;
text-align: center;
text-decoration: none;
text-overflow: ellipsis;
text-transform: uppercase;
white-space: nowrap;
cursor: pointer;
user-select: none;
border: 0;
border-style: solid;
border-width: 0;
border-top-left-radius: $radius;
border-top-right-radius: $radius;
outline: none;
transition: background-color $core-time ease;
}
.inner {
padding: 0 16px;
margin-bottom: 2px;
border-style: solid;
border-width: 0;
}
.router-link-active .inner {
margin-bottom: 0;
border-bottom-width: 2px;
}
</style>