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 = {
77 block: Boolean ,
88 pill: Boolean ,
99 square: Boolean ,
10- ghost: Boolean ,
11- outline: Boolean ,
10+ variant: {
11+ type: String ,
12+ validator : val => [' ' , ' ghost' , ' outline' ].includes (val)
13+ },
1214 size: {
1315 type: String ,
1416 validator : value => [' ' , ' sm' , ' lg' ].includes (value)
@@ -34,10 +36,11 @@ function isToggle (props) {
3436}
3537
3638function computeClasses (props ) {
39+ const outlineSuffix = props .variant === ' outline' ? ' outline-' : ' '
3740 return {
38- [` btn-${ props . outline ? ' outline- ' : ' ' }${ props .color } ` ]: props .color ,
41+ [` btn-${ outlineSuffix }${ props .color } ` ]: props .color ,
3942 [` btn-${ props .size } ` ]: Boolean (props .size ),
40- [` btn-ghost-${ props .color } ` ]: props .ghost ,
43+ [` btn-ghost-${ props .color } ` ]: props .variant === ' ghost' ,
4144 ' btn-block' : props .block ,
4245 ' btn-pill' : props .pill ,
4346 ' btn-square' : props .square && ! props .pill ,
Original file line number Diff line number Diff line change @@ -12,8 +12,7 @@ const toggleWrapper = mount(Component, {
1212 type : 'input' ,
1313 size : 'lg' ,
1414 color : 'info' ,
15- outline : true ,
16- ghost : true ,
15+ variant : 'outline' ,
1716 block : true ,
1817 square : true
1918 }
@@ -32,7 +31,7 @@ const routerLinkWrapper = mount(Component, {
3231 to : '/dashboard' ,
3332 size : 'sm' ,
3433 color : 'success' ,
35- ghost : true ,
34+ variant : 'ghost' ,
3635 pill : true
3736 }
3837 } ,
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ exports[`CButton renders correctly toggle button 1`] = `
2323<button
2424 aria-pressed = " true"
2525 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"
2727 type = " input"
2828>
2929 <template >
Original file line number Diff line number Diff line change @@ -29,8 +29,7 @@ export declare class CButton extends CLink {
2929 block : boolean
3030 pill : boolean
3131 square : boolean
32- ghost : boolean
33- outline : boolean
32+ variant : string
3433 size : string
3534 color : string
3635 type : string
@@ -396,8 +395,7 @@ export declare class CModal extends Vue {
396395export declare class CNav extends Vue {
397396 fill : boolean
398397 justified : boolean
399- tabs : boolean
400- pills : boolean
398+ variant : string
401399 vertical : boolean
402400 inCard : boolean
403401}
Original file line number Diff line number Diff line change 88export default {
99 name: ' CNav' ,
1010 props: {
11+ variant: {
12+ type: String ,
13+ validator : val => [' ' , ' tabs' , ' pills' ].includes (val)
14+ },
1115 fill: Boolean ,
1216 justified: Boolean ,
13- tabs: Boolean ,
14- pills: Boolean ,
1517 vertical: Boolean ,
1618 inCard: Boolean
1719 },
1820 computed: {
1921 navClasses () {
20- const hasTabs = this .tabs && ! this .pills
2122 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' ,
2526 ' flex-column' : this .vertical ,
2627 ' nav-fill' : this .fill ,
2728 ' 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'
3031 }
3132 }
3233 },
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import CNavItem from '../CNavItem'
66const ComponentName = 'CNav'
77const wrapper = mount ( Component , {
88 propsData : {
9- tabs : true ,
9+ variant : 'tabs' ,
1010 } ,
1111 slots : {
1212 default : 'CNav items'
@@ -21,7 +21,7 @@ const customWrapper = mount(Component, {
2121 propsData : {
2222 fill : true ,
2323 justified : true ,
24- pills : true ,
24+ variant : 'pills' ,
2525 vertical : true ,
2626 inCard : true
2727 } ,
You can’t perform that action at this time.
0 commit comments