Skip to content

Commit

Permalink
feat: CSidebarNavItem: add color prop
Browse files Browse the repository at this point in the history
  • Loading branch information
woothu committed Jun 29, 2020
1 parent 833d98a commit 3bb6c1f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/components/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ export declare class CSidebarNavItem extends CLink {
badge?: object
addLinkClasses?: string
label?: boolean
color?: string
}

export declare class CSidebarNavTitle extends Vue {}
Expand Down
4 changes: 3 additions & 1 deletion src/components/template/CSidebarNavItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ const props = Object.assign(
fontIcon: String,
badge: Object,
addLinkClasses: [String, Array, Object],
label: Boolean
label: Boolean,
color: String
}
)
Expand All @@ -65,6 +66,7 @@ export default {
linkClasses () {
return [
this.label ? 'c-sidebar-nav-label' : 'c-sidebar-nav-link',
this.color && `c-sidebar-nav-link-${this.color}`,
this.addLinkClasses
]
},
Expand Down
3 changes: 2 additions & 1 deletion src/components/template/tests/CSidebarNavItem.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const wrapper = mount(Component, {
badge: {
color: 'success',
text: 'NEW'
}
},
color: 'success'
},
attrs: {
id: 'link'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`CSidebarNavItem.vue renders correctly 1`] = `
id="link"
>
<a
class="c-sidebar-nav-link"
class="c-sidebar-nav-link c-sidebar-nav-link-success"
href="#"
target="_self"
>
Expand Down

0 comments on commit 3bb6c1f

Please sign in to comment.