This repository has been archived by the owner on Sep 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
TabsNavItem.vue
92 lines (82 loc) · 1.52 KB
/
TabsNavItem.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
<template>
<router-link
:to="{ name: 'tabs', params: { id: item.id } }"
:class="$style.item"
:active-class="$style.active"
tag="button"
>
<div
v-if="pageState.hasNotificationBadge"
:class="$style.badge"
/>
<div
:class="{
[$style.thumb]: true,
[$style.thumbIsImage]: pageState.favicon,
[$style.thumbIsIcon]: !pageState.favicon,
}"
>
<img
v-if="pageState.favicon"
:src="pageState.favicon"
:class="$style.image"
>
<app-icon
v-else
face="tab"
/>
</div>
<div :class="$style.label">
{{ item.label }}
</div>
</router-link>
</template>
<script>
export default {
props: {
item: {
type: Object,
default: () => ({}),
},
},
computed: {
pageState() {
return this.$store.getters['Pages/state'](this.item.id);
},
},
};
</script>
<style lang="postcss" module>
.item {
@apply
flex flex-no-shrink items-center p-2
text-grey-dark text-left rounded-sm;
}
.item + .item {
@apply mt-1;
}
.active {
@apply text-grey-light bg-grey-darkest shadow;
}
.badge {
@apply absolute pin-l w-2 h-2 bg-grey-darker rounded-full;
transform: translateX(-50%);
}
.thumb {
@apply
flex flex-no-shrink justify-center items-center
p-1 w-8 h-8 mr-3 rounded-sm;
}
.thumbIsImage {
@apply bg-grey-lightest;
}
.thumbIsIcon {
@apply text-grey bg-grey-darker;
}
.image {
@apply block max-w-full max-h-full;
}
.label {
@apply truncate;
}
</style>