Skip to content

Commit 5cd09d8

Browse files
authored
Merge pull request #61 from ProtocolONE/navbar_with_scrolls
Perfect scrollbars for PageNavbar
2 parents e099be7 + 04ef651 commit 5cd09d8

File tree

3 files changed

+46
-22
lines changed

3 files changed

+46
-22
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
"dependencies": {
88
"date-fns": "^v2.0.0-alpha.27",
99
"lodash-es": "^4.17.11",
10+
"perfect-scrollbar": "^1.4.0",
1011
"vue": "^2.5.21",
1112
"vue-clickaway": "^2.2.2",
13+
"vue-perfect-scrollbar": "^0.1.0",
1214
"vue-wysiwyg": "^1.7.2",
1315
"vuejs-datepicker": "^1.5.4"
1416
},

src/PageNavbar.vue

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,27 @@
1919

2020
<template>
2121
<div class="page-navbar">
22-
<component
23-
:is="logoLinkTagName"
24-
class="logo"
25-
:to="logoLink && isRouter(logoLink.router) ? url : null"
26-
:href="logoLink ? url : null"
27-
>
28-
<span class="logo-icon">
29-
<slot name="logo" />
30-
</span>
31-
<span class="logo-title">
32-
{{ title }}
33-
<slot name="title" />
34-
</span>
35-
</component>
36-
37-
<div class="navgition-links">
22+
23+
<div class="top">
24+
<component
25+
:is="logoLinkTagName"
26+
class="logo"
27+
:to="logoLink && isRouter(logoLink.router) ? url : null"
28+
:href="logoLink ? url : null"
29+
>
30+
<span class="logo-icon">
31+
<slot name="logo" />
32+
</span>
33+
<span class="logo-title">
34+
{{ title }}
35+
<slot name="title" />
36+
</span>
37+
</component>
38+
</div>
39+
40+
<VuePerfectScrollbar
41+
class="navgition-links"
42+
:settings="{suppressScrollX: true}">
3843
<component
3944
v-for="(link, index) in navigationLinks"
4045
:is="isRouter(link.router) ? routerComponentName : 'a'"
@@ -46,7 +51,7 @@
4651
<span class="navgition-link-icon" />
4752
<span v-text="link.label" />
4853
</component>
49-
</div>
54+
</VuePerfectScrollbar>
5055

5156
<div class="bottom">
5257
<slot name="bottom" />
@@ -103,11 +108,13 @@
103108
</template>
104109

105110
<script>
111+
import VuePerfectScrollbar from 'vue-perfect-scrollbar';
106112
import IconAuth from './IconAuth.vue';
107113
108114
export default {
109115
components: {
110116
IconAuth,
117+
VuePerfectScrollbar,
111118
},
112119
props: {
113120
/**
@@ -182,6 +189,12 @@ export default {
182189
};
183190
</script>
184191

192+
<style lang="scss">
193+
.ps__scrollbar-y-rail {
194+
background: none !important;
195+
}
196+
</style>
197+
185198
<style scoped lang="scss">
186199
$navbar-color: #203d5f;
187200
$hover-navbar-item-color: #2f6ecd;
@@ -199,6 +212,9 @@ $hover-font-color: #fff;
199212
color: $font-color;
200213
z-index: 10;
201214
215+
display: flex;
216+
flex-direction: column;
217+
202218
&:before {
203219
content: '';
204220
position: fixed;
@@ -264,9 +280,8 @@ $hover-font-color: #fff;
264280
}
265281
266282
.navgition-links {
267-
width: 100%;
283+
height: 100%;
268284
white-space: nowrap;
269-
overflow: hidden;
270285
}
271286
.navgition-link {
272287
padding: 16px;
@@ -306,11 +321,8 @@ $hover-font-color: #fff;
306321
}
307322
308323
.bottom {
309-
position: absolute;
310-
bottom: 0;
311324
width: 100%;
312325
white-space: nowrap;
313-
overflow: hidden;
314326
}
315327
316328
.user {

yarn.lock

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5143,6 +5143,11 @@ pbkdf2@^3.0.3:
51435143
safe-buffer "^5.0.1"
51445144
sha.js "^2.4.8"
51455145

5146+
perfect-scrollbar@^1.4.0:
5147+
version "1.4.0"
5148+
resolved "https://registry.yarnpkg.com/perfect-scrollbar/-/perfect-scrollbar-1.4.0.tgz#5d014ef9775e1f43058a1dbae9ed1daf0e7091f1"
5149+
integrity sha512-/2Sk/khljhdrsamjJYS5NjrH+GKEHEwh7zFSiYyxROyYKagkE4kSn2zDQDRTOMo8mpT2jikxx6yI1dG7lNP/hw==
5150+
51465151
performance-now@^2.1.0:
51475152
version "2.1.0"
51485153
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
@@ -6958,6 +6963,11 @@ vue-loader@^15.4.2:
69586963
vue-hot-reload-api "^2.3.0"
69596964
vue-style-loader "^4.1.0"
69606965

6966+
vue-perfect-scrollbar@^0.1.0:
6967+
version "0.1.0"
6968+
resolved "https://registry.yarnpkg.com/vue-perfect-scrollbar/-/vue-perfect-scrollbar-0.1.0.tgz#be12c23d1753a013fa81ceb9872cb5fc0b1b4960"
6969+
integrity sha512-l/ZEidPDFplXeDtxs+gO3D8efhwqyIEcUtfvfRujCQemcn39ghpSNoizWWZYI6Ro0iz3yP+w7LqNxEBjE+T1qQ==
6970+
69616971
vue-style-loader@^4.1.0:
69626972
version "4.1.2"
69636973
resolved "https://registry.yarnpkg.com/vue-style-loader/-/vue-style-loader-4.1.2.tgz#dedf349806f25ceb4e64f3ad7c0a44fba735fcf8"

0 commit comments

Comments
 (0)