File tree Expand file tree Collapse file tree 6 files changed +23
-22
lines changed Expand file tree Collapse file tree 6 files changed +23
-22
lines changed Original file line number Diff line number Diff line change @@ -7,8 +7,10 @@ const btnProps = {
7
7
block: Boolean ,
8
8
pill: Boolean ,
9
9
square: Boolean ,
10
- ghost: Boolean ,
11
- outline: Boolean ,
10
+ variant: {
11
+ type: String ,
12
+ validator : val => [' ' , ' ghost' , ' outline' ].includes (val)
13
+ },
12
14
size: {
13
15
type: String ,
14
16
validator : value => [' ' , ' sm' , ' lg' ].includes (value)
@@ -34,10 +36,11 @@ function isToggle (props) {
34
36
}
35
37
36
38
function computeClasses (props ) {
39
+ const outlineSuffix = props .variant === ' outline' ? ' outline-' : ' '
37
40
return {
38
- [` btn-${ props . outline ? ' outline- ' : ' ' }${ props .color } ` ]: props .color ,
41
+ [` btn-${ outlineSuffix }${ props .color } ` ]: props .color ,
39
42
[` btn-${ props .size } ` ]: Boolean (props .size ),
40
- [` btn-ghost-${ props .color } ` ]: props .ghost ,
43
+ [` btn-ghost-${ props .color } ` ]: props .variant === ' ghost' ,
41
44
' btn-block' : props .block ,
42
45
' btn-pill' : props .pill ,
43
46
' btn-square' : props .square && ! props .pill ,
Original file line number Diff line number Diff line change @@ -12,8 +12,7 @@ const toggleWrapper = mount(Component, {
12
12
type : 'input' ,
13
13
size : 'lg' ,
14
14
color : 'info' ,
15
- outline : true ,
16
- ghost : true ,
15
+ variant : 'outline' ,
17
16
block : true ,
18
17
square : true
19
18
}
@@ -32,7 +31,7 @@ const routerLinkWrapper = mount(Component, {
32
31
to : '/dashboard' ,
33
32
size : 'sm' ,
34
33
color : 'success' ,
35
- ghost : true ,
34
+ variant : 'ghost' ,
36
35
pill : true
37
36
}
38
37
} ,
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ exports[`CButton renders correctly toggle button 1`] = `
23
23
<button
24
24
aria-pressed = " true"
25
25
autocomplete = " off"
26
- class = " btn btn-outline-info btn-lg btn-ghost-info btn- block btn-square active"
26
+ class = " btn btn-outline-info btn-lg btn-block btn-square active"
27
27
type = " input"
28
28
>
29
29
<template >
Original file line number Diff line number Diff line change @@ -29,8 +29,7 @@ export declare class CButton extends CLink {
29
29
block : boolean
30
30
pill : boolean
31
31
square : boolean
32
- ghost : boolean
33
- outline : boolean
32
+ variant : string
34
33
size : string
35
34
color : string
36
35
type : string
@@ -396,8 +395,7 @@ export declare class CModal extends Vue {
396
395
export declare class CNav extends Vue {
397
396
fill : boolean
398
397
justified : boolean
399
- tabs : boolean
400
- pills : boolean
398
+ variant : string
401
399
vertical : boolean
402
400
inCard : boolean
403
401
}
Original file line number Diff line number Diff line change 8
8
export default {
9
9
name: ' CNav' ,
10
10
props: {
11
+ variant: {
12
+ type: String ,
13
+ validator : val => [' ' , ' tabs' , ' pills' ].includes (val)
14
+ },
11
15
fill: Boolean ,
12
16
justified: Boolean ,
13
- tabs: Boolean ,
14
- pills: Boolean ,
15
17
vertical: Boolean ,
16
18
inCard: Boolean
17
19
},
18
20
computed: {
19
21
navClasses () {
20
- const hasTabs = this .tabs && ! this .pills
21
22
return {
22
- ' nav' : true ,
23
- ' nav-tabs' : hasTabs ,
24
- ' nav-pills' : this .pills ,
23
+ ' nav' : true ,
24
+ ' nav-tabs' : this . variant === ' tabs ' ,
25
+ ' nav-pills' : this .variant === ' pills' ,
25
26
' flex-column' : this .vertical ,
26
27
' nav-fill' : this .fill ,
27
28
' nav-justified' : this .justified ,
28
- ' card-header-tabs' : this .inCard && hasTabs ,
29
- ' card-header-pills' : this .inCard && this .pills
29
+ ' card-header-tabs' : this .inCard && this . variant === ' tabs ' ,
30
+ ' card-header-pills' : this .inCard && this .variant === ' pills'
30
31
}
31
32
}
32
33
},
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import CNavItem from '../CNavItem'
6
6
const ComponentName = 'CNav'
7
7
const wrapper = mount ( Component , {
8
8
propsData : {
9
- tabs : true ,
9
+ variant : 'tabs' ,
10
10
} ,
11
11
slots : {
12
12
default : 'CNav items'
@@ -21,7 +21,7 @@ const customWrapper = mount(Component, {
21
21
propsData : {
22
22
fill : true ,
23
23
justified : true ,
24
- pills : true ,
24
+ variant : 'pills' ,
25
25
vertical : true ,
26
26
inCard : true
27
27
} ,
You can’t perform that action at this time.
0 commit comments