Skip to content

Commit 445153b

Browse files
committed
refactor: CNavbar: change toggleable prop to expandable
- fix navbar-expand class suffix generation
1 parent 3d8fd2f commit 445153b

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

src/components/Navbar/CNavbar.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ export const props = {
88
},
99
light: Boolean,
1010
variant: String,
11-
toggleable: {
11+
expandable: {
1212
type: [Boolean, String],
13-
default: false,
14-
validator: val => ['', false, true, 'sm', 'md', 'lg', 'xl'].includes(val)
13+
default: false
1514
},
1615
fixed: {
1716
type: String,
@@ -26,7 +25,7 @@ export default {
2625
functional: true,
2726
props,
2827
render (h, { props, data, children }) {
29-
const expandClassSuffix = props.toggleable === true ? '' : props.toggleable
28+
const expandClassSuffix = props.expandable === true ? '' : `-${props.expandable}`
3029
return h(
3130
props.tag,
3231
mergeData(data, {
@@ -38,7 +37,7 @@ export default {
3837
'sticky-top': props.sticky,
3938
[`bg-${props.variant}`]: Boolean(props.variant),
4039
[`fixed-${props.fixed}`]: Boolean(props.fixed),
41-
[`navbar-expand-${expandClassSuffix}`]: Boolean(props.toggleable)
40+
[`navbar-expand${expandClassSuffix}`]: Boolean(props.expandable)
4241
}
4342
],
4443
attrs: {

src/components/Navbar/tests/CNavbar.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const customWrapper = mount(Component, {
1010
pills: true,
1111
vertical: true,
1212
fixed: 'top',
13-
toggleable: true,
13+
expandable: true,
1414
light: true,
1515
tag: 'div'
1616
},

src/components/Navbar/tests/__snapshots__/CNavbar.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ exports[`CNavbar renders correctly 1`] = `
88

99
exports[`CNavbar renders correctly 2`] = `
1010
<div
11-
class="navbar navbar-light fixed-top navbar-expand-"
11+
class="navbar navbar-light fixed-top navbar-expand"
1212
fill="true"
1313
justified="true"
1414
pills="true"

src/components/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ export declare class CNavbar extends Vue {
400400
tag: string
401401
light: boolean
402402
variant: string
403-
toggleable: [boolean, string]
403+
expandable: [boolean, string]
404404
fixed: string
405405
sticky: boolean
406406
print: boolean

0 commit comments

Comments
 (0)