Skip to content

Commit 0340dee

Browse files
author
Guillaume Chau
committed
feat(ui): ProjectNav: display labels when screen is wide
1 parent 6bb64a9 commit 0340dee

File tree

6 files changed

+57
-5
lines changed

6 files changed

+57
-5
lines changed

packages/@vue/cli-ui/src/components/ProjectNav.vue

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<template>
2-
<div class="project-nav">
2+
<div
3+
class="project-nav"
4+
:class="{
5+
wide: $responsive.wide
6+
}"
7+
>
38
<div class="content">
49
<VueGroup
510
v-model="currentView"
@@ -139,4 +144,18 @@ export default {
139144
button-colors($vue-ui-color-light, $bg)
140145
&.selected
141146
button-colors(lighten($vue-ui-color-primary, 40%), $bg)
147+
148+
&.wide
149+
>>> .vue-ui-button
150+
justify-content flex-start
151+
padding-left $padding-item
152+
padding-right @padding-left
153+
> .content
154+
width 100%
155+
text-align left
156+
> .default-slot
157+
flex auto 1 1
158+
width 0
159+
margin-left 6px
160+
ellipsis()
142161
</style>

packages/@vue/cli-ui/src/components/ProjectNavButton.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
:delay="{ show: 300, hide: 0 }"
1010
>
1111
<VueGroupButton
12-
class="flat big icon-button"
12+
class="flat big"
13+
:class="{
14+
'icon-button': $responsive.wide
15+
}"
1316
:value="view.name"
1417
:icon-left="!imageIcon && view.icon"
1518
>
@@ -18,6 +21,8 @@
1821
:src="view.icon"
1922
class="image-icon"
2023
>
24+
25+
<span v-if="$responsive.wide" class="label">{{ $t(view.tooltip) }}</span>
2126
</VueGroupButton>
2227

2328
<template slot="popover">

packages/@vue/cli-ui/src/components/ProjectNavMore.vue

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
slot="trigger"
66
icon-left="more_horiz"
77
class="icon-button big flat"
8-
/>
8+
>
9+
<span v-if="$responsive.wide" class="label">{{ $t('components.project-nav.tooltips.more') }}</span>
10+
</VueButton>
911

1012
<VueDropdownButton
1113
icon-left="work"
@@ -20,3 +22,17 @@
2022
</VueDropdown>
2123
</div>
2224
</template>
25+
26+
<style lang="stylus" scoped>
27+
@import "~@/style/imports"
28+
29+
.project-nav-more
30+
.vue-ui-dropdown.open .dropdown-trigger .vue-ui-button
31+
&,
32+
&:hover
33+
background lighten($vue-ui-color-dark, 10%) !important
34+
color $md-white
35+
/deep/ > .content > .button-icon
36+
svg
37+
fill @color
38+
</style>

packages/@vue/cli-ui/src/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@
6262
"tooltips": {
6363
"plugins": "Plugins",
6464
"configuration": "Configuration",
65-
"tasks": "Tasks"
65+
"tasks": "Tasks",
66+
"more": "More"
6667
}
6768
},
6869
"project-select-list": {

packages/@vue/cli-ui/src/main.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ Vue.use(Responsive, {
2828
},
2929
desktop () {
3030
return !this.tablet
31+
},
32+
wide () {
33+
return this.width >= 1600
3134
}
3235
}
3336
})

packages/@vue/cli-ui/src/views/ProjectHome.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<template>
2-
<div class="project-home page">
2+
<div
3+
class="project-home page"
4+
:class="{
5+
wide: $responsive.wide
6+
}"
7+
>
38
<ProjectNav/>
49

510
<div v-if="ready" class="content">
@@ -38,6 +43,9 @@ export default {
3843
grid-template-rows auto
3944
grid-template-areas "side-left content"
4045
46+
&.wide
47+
grid-template-columns 250px 1fr
48+
4149
.project-nav
4250
grid-area side-left
4351

0 commit comments

Comments
 (0)