File tree Expand file tree Collapse file tree 22 files changed +198
-157
lines changed Expand file tree Collapse file tree 22 files changed +198
-157
lines changed Original file line number Diff line number Diff line change 3
3
import PerfectScrollbar from ' perfect-scrollbar'
4
4
5
5
export default {
6
- name: ' CPerfectScrollbar ' ,
6
+ name: ' CScrollbar ' ,
7
7
props: {
8
8
settings: {
9
9
type: Object ,
Original file line number Diff line number Diff line change
1
+ import CScrollbar from './CScrollbar'
2
+
3
+ export {
4
+ CScrollbar
5
+ }
Original file line number Diff line number Diff line change 1
1
import { mount } from '@vue/test-utils'
2
- import CSidebarNav from '../CSidebarNav'
3
- import CSidebar from '../CSidebar'
4
- import Component from '../CPerfectScrollbar '
2
+ import CSidebarNav from '../../Sidebar/ CSidebarNav'
3
+ import CSidebar from '../../Sidebar/ CSidebar'
4
+ import Component from '../CScrollbar '
5
5
import Vue from 'vue'
6
6
7
7
8
- const ComponentName = 'CPerfectScrollbar '
8
+ const ComponentName = 'CScrollbar '
9
9
const wrapper = mount ( Component , {
10
10
propsData : {
11
11
switcher : false
Original file line number Diff line number Diff line change
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports [` CPerfectScrollbar .vue renders correctly 1` ] = `
4
+ <div
5
+ style = " position: relative;"
6
+ />
7
+ ` ;
8
+
9
+ exports [` CPerfectScrollbar .vue renders correctly in sidebar 1` ] = `
10
+ <div
11
+ class = " c-sidebar c-sidebar-dark c-sidebar-lg-show c-sidebar-fixed"
12
+ >
13
+ <ul
14
+ class = " c-scroll-area c-sidebar-nav ps"
15
+ style = " position: relative;"
16
+ >
17
+ <div
18
+ class = " ps__rail-x"
19
+ style = " left: 0px; top: 0px;"
20
+ >
21
+ <div
22
+ class = " ps__thumb-x"
23
+ style = " left: 0px; width: 0px;"
24
+ tabindex = " 0"
25
+ />
26
+ </div >
27
+ <div
28
+ class = " ps__rail-y"
29
+ style = " top: 0px; left: 0px;"
30
+ >
31
+ <div
32
+ class = " ps__thumb-y"
33
+ style = " top: 0px; height: 0px;"
34
+ tabindex = " 0"
35
+ />
36
+ </div >
37
+ </ul >
38
+ </div >
39
+ ` ;
40
+
41
+ exports [` CScrollbar .vue renders correctly 1` ] = `
42
+ <div
43
+ style = " position: relative;"
44
+ />
45
+ ` ;
46
+
47
+ exports [` CScrollbar .vue renders correctly in sidebar 1` ] = `
48
+ <div
49
+ class = " c-sidebar c-sidebar-dark c-sidebar-lg-show c-sidebar-fixed"
50
+ >
51
+ <ul
52
+ class = " c-scroll-area c-sidebar-nav ps"
53
+ style = " position: relative;"
54
+ >
55
+ <div
56
+ class = " ps__rail-x"
57
+ style = " left: 0px; top: 0px;"
58
+ >
59
+ <div
60
+ class = " ps__thumb-x"
61
+ style = " left: 0px; width: 0px;"
62
+ tabindex = " 0"
63
+ />
64
+ </div >
65
+ <div
66
+ class = " ps__rail-y"
67
+ style = " top: 0px; left: 0px;"
68
+ >
69
+ <div
70
+ class = " ps__thumb-y"
71
+ style = " top: 0px; height: 0px;"
72
+ tabindex = " 0"
73
+ />
74
+ </div >
75
+ </ul >
76
+ </div >
77
+ ` ;
Original file line number Diff line number Diff line change 8
8
export default {
9
9
name: ' CSidebar' ,
10
10
props: {
11
- fixed: Boolean ,
11
+ fixed: {
12
+ type: Boolean ,
13
+ default: true
14
+ },
12
15
unfoldable: Boolean ,
16
+ overlaid: Boolean ,
13
17
breakpoint: {
14
18
type: [String , Boolean ],
15
19
default: ' lg' ,
@@ -20,6 +24,10 @@ export default {
20
24
type: Boolean ,
21
25
default: null
22
26
},
27
+ size: {
28
+ type: String ,
29
+ validator : (val ) => [' ' , ' sm' , ' lg' , ' xl' ].includes (val)
30
+ },
23
31
hideOnMobileClick: {
24
32
type: Boolean ,
25
33
default: true
@@ -42,7 +50,7 @@ export default {
42
50
provide () {
43
51
const state = {}
44
52
Object .defineProperty (state, ' minimize' , {
45
- get : () => this .minimize
53
+ get : () => this .minimize && ! this . unfoldable
46
54
})
47
55
return {
48
56
state,
@@ -81,7 +89,9 @@ export default {
81
89
' c-sidebar-fixed' : this .fixed ,
82
90
' c-sidebar-right' : this .aside ,
83
91
' c-sidebar-minimized' : this .minimize && ! this .unfoldable ,
84
- ' c-sidebar-minimized-unfoldable' : this .minimize && this .unfoldable
92
+ ' c-sidebar-unfoldable' : this .minimize && this .unfoldable ,
93
+ ' c-sidebar-overlaid' : this .overlaid ,
94
+ [` c-sidebar-${ this .size } ` ]: this .size ,
85
95
}
86
96
]
87
97
}
Original file line number Diff line number Diff line change 1
1
<template >
2
- <CButtonClose buttonClasses =" c-sidebar-close" />
2
+ <CButtonClose buttonClasses =" c-sidebar-close" >
3
+ <svg class =" c-icon" width =" 24" height =" 24" viewBox =" 0 0 24 24" >
4
+ <title >x</title >
5
+ <path d =" M20.030 5.030l-1.061-1.061-6.97 6.97-6.97-6.97-1.061 1.061 6.97 6.97-6.97 6.97 1.061 1.061 6.97-6.97 6.97 6.97 1.061-1.061-6.97-6.97 6.97-6.97z" ></path >
6
+ </svg >
7
+ </CButtonClose >
3
8
</template >
4
9
5
10
<script >
Original file line number Diff line number Diff line change 1
1
<template >
2
- <nav class =" c-sidebar-nav" >
3
- <VuePerfectScrollbar
4
- class =" c-scroll-area"
5
- :settings =" psSettings"
6
- :switcher =" !state.minimize"
7
- >
8
- <ul class =" c-nav" >
9
- <slot ></slot >
10
- </ul >
11
- </VuePerfectScrollbar >
12
- </nav >
2
+ <CScrollbar
3
+ class =" c-scroll-area c-sidebar-nav"
4
+ :settings =" psSettings"
5
+ :switcher =" !state.minimize"
6
+ tag =" ul"
7
+ >
8
+ <slot ></slot >
9
+ </CScrollbar >
13
10
</template >
14
11
15
12
<script >
16
- import VuePerfectScrollbar from ' ./CPerfectScrollbar '
13
+ import CScrollbar from ' ../Scrollbar/CScrollbar '
17
14
18
15
export default {
19
16
name: ' CSidebarNav' ,
20
17
components: {
21
- VuePerfectScrollbar
18
+ CScrollbar
22
19
},
23
20
inject: {
24
21
state: {
@@ -42,6 +39,5 @@ export default {
42
39
<style scoped>
43
40
.c-scroll-area {
44
41
height : 100% ;
45
- margin : auto ;
46
42
}
47
43
</style >
Original file line number Diff line number Diff line change 1
1
<template functional>
2
- <li class =" c-nav-divider" ></li >
2
+ <li class =" c-sidebar- nav-divider" ></li >
3
3
</template >
4
4
5
5
<script >
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<li :class =" dropdownClasses" >
3
- <a class =" c-nav-link c-nav-dropdown-toggle" @click =" handleClick" >
3
+ <a class =" c-sidebar- nav-link c-sidebar -nav-dropdown-toggle" @click =" handleClick" >
4
4
<i v-if =" icon" :class =" classIcon" ></i >
5
5
{{name}}
6
6
</a >
7
- <ul class =" c-nav-dropdown-items" @click =" itemClicked" >
7
+ <ul class =" c-sidebar- nav-dropdown-items" @click =" itemClicked" >
8
8
<slot ></slot >
9
9
</ul >
10
10
</li >
@@ -55,12 +55,12 @@ export default {
55
55
},
56
56
computed: {
57
57
classIcon () {
58
- return [' c-nav-icon' , this .icon ]
58
+ return [' c-sidebar- nav-icon' , this .icon ]
59
59
},
60
60
dropdownClasses () {
61
61
return [
62
- ' c-nav-item c-nav-dropdown' ,
63
- { ' c-open ' : this .open }
62
+ ' c-sidebar- nav-item c-sidebar -nav-dropdown' ,
63
+ { ' c-show ' : this .open }
64
64
]
65
65
}
66
66
},
Original file line number Diff line number Diff line change 1
1
<template >
2
- <li class =" c-nav-item" >
2
+ <li class =" c-sidebar- nav-item" >
3
3
<CLink
4
4
:class =" linkClasses"
5
5
v-bind =" computedLinkProps"
6
6
@click.native =" click"
7
7
>
8
8
<slot >
9
- <i :class =" ['c-nav-icon', icon]" ></i >
9
+ <i :class =" ['c-sidebar- nav-icon', icon]" ></i >
10
10
{{name}}
11
11
<CBadge
12
12
v-if =" badge"
@@ -51,7 +51,7 @@ export default {
51
51
},
52
52
linkClasses () {
53
53
return [
54
- this .label ? ' c-nav-label' : ' c-nav-link' ,
54
+ this .label ? ' c-sidebar- nav-label' : ' c-sidebar -nav-link' ,
55
55
this .addLinkClasses
56
56
]
57
57
}
Original file line number Diff line number Diff line change 1
1
<template functional>
2
- <li class =" c-nav-title" >
2
+ <li class =" c-sidebar- nav-title" >
3
3
<slot ></slot >
4
4
</li >
5
5
</template >
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ describe(ComponentName, () => {
43
43
expect ( wrapper . vm . open ) . toBe ( true )
44
44
} )
45
45
it ( 'changes state when clicked on toggle' , ( ) => {
46
- wrapper . find ( '.c-nav-link' ) . trigger ( 'click' )
46
+ wrapper . find ( '.c-sidebar- nav-link' ) . trigger ( 'click' )
47
47
expect ( wrapper . vm . open ) . toBe ( false )
48
48
expect ( wrapper . emitted ( ) [ 'update:show' ] ) . toBeTruthy ( )
49
49
} )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2
2
3
3
exports [` CSidebar .vue renders correctly 1` ] = `
4
4
<div
5
- class = " c-sidebar c-sidebar-light c-sidebar-lg-show c-sidebar-right"
5
+ class = " c-sidebar c-sidebar-light c-sidebar-lg-show c-sidebar-fixed c-sidebar- right"
6
6
id = " sidebar"
7
7
/>
8
8
` ;
9
9
10
10
exports [` CSidebar .vue renders correctly 2` ] = `
11
11
<div >
12
12
<div
13
- class = " c-sidebar c-sidebar-dark c-sidebar-show c-sidebar-lg-show"
13
+ class = " c-sidebar c-sidebar-dark c-sidebar-show c-sidebar-lg-show c-sidebar-fixed "
14
14
>
15
15
<a
16
16
href = " /some-path"
You can’t perform that action at this time.
0 commit comments