forked from vuejs/vue-cli
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProjectNav.vue
94 lines (86 loc) · 1.87 KB
/
ProjectNav.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
<template>
<div class="project-nav">
<div class="content">
<VueGroup
v-model="currentRoute"
class="vertical small-indicator left-indicator primary"
indicator
>
<VueGroupButton
v-for="route of routes"
:key="route.name"
class="flat big icon-button"
:value="route.name"
:icon-left="route.icon"
v-tooltip.right="renderTooltip(route.tooltip)"
/>
</VueGroup>
</div>
</div>
</template>
<script>
const BUILTIN_ROUTES = [
{
name: 'project-plugins',
icon: 'widgets',
tooltip: 'plugins'
},
{
name: 'project-configuration',
icon: 'settings_applications',
tooltip: 'configuration'
},
{
name: 'project-tasks',
icon: 'assignment',
tooltip: 'tasks'
}
]
export default {
data () {
return {
routes: [
...BUILTIN_ROUTES
// Plugins routes here
// TODO
]
}
},
computed: {
currentRoute: {
get () {
const currentRoute = this.$route.name
const route = this.routes.find(
r => currentRoute.indexOf(r.name) === 0
)
return route ? route.name : null
},
set (name) {
if (this.$route.name !== name) {
this.$router.push({ name })
}
}
}
},
methods: {
renderTooltip (target) {
return this.$t(`components.project-nav.tooltips.${target}`)
}
}
}
</script>
<style lang="stylus" scoped>
@import "~@/style/imports"
.project-nav
background $vue-ui-color-dark
.content
v-box()
>>> .vue-ui-button
button-colors(rgba($vue-ui-color-light, .7), transparent)
border-radius 0
&:hover
$bg = darken($vue-ui-color-dark, 70%)
button-colors($vue-ui-color-light, $bg)
&.selected
button-colors(lighten($vue-ui-color-primary, 40%), $bg)
</style>