Skip to content

Commit

Permalink
feat(drawer): add support for drawer-item activated style
Browse files Browse the repository at this point in the history
closes #247
  • Loading branch information
stasson committed Feb 11, 2018
1 parent b6bdac7 commit 94c6c59
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions components/drawer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ By default the drawer component is responsive and will switch from temporary to
|`exact`|Boolean| false | router-link property _(*)_ |
|`active-class`|String| router-link-active | router-link property _(*)_ |
|`exact-active-class`|String| router-link-exact-active | router-link property _(*)_ |
|`activated`|Boolean| undefined | whether this item is selected (not needed if router-link mode is used) |

> _(*)_ Requires [vue-router](https://router.vuejs.org)
> If the `to` property is defined, the item behaves as a
Expand Down
19 changes: 16 additions & 3 deletions components/drawer/mdc-drawer-item.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<custom-link :link="link"
class="mdc-drawer-item mdc-list-item"
:class="classes" :style="styles"
:class="[classes. itemClasses]" :style="styles"
@click="onClick">
<span class="mdc-list-item__graphic" v-if="hasStartDetail">
<slot name="start-detail">
Expand All @@ -21,8 +21,16 @@ export default {
inject: ['mdcDrawer'],
mixins: [DispatchEventMixin, CustomLinkMixin],
props: {
'start-icon': String,
'temporary-close': {type: Boolean, default: true},
startIcon: String,
temporaryClose: {
type: Boolean,
default: true
},
activated: Boolean,
exactActiveClass: {
type: String,
default: 'mdc-list-item--activated'
}
},
data () {
return {
Expand All @@ -31,6 +39,11 @@ export default {
}
},
computed: {
itemClasses () {
return {
'mdc-list-item--activated': this.activated
}
},
hasStartDetail () {
return this.startIcon || this.$slots['start-detail']
}
Expand Down
4 changes: 0 additions & 4 deletions demo/styles/demo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ $mdc-theme-background: #fff;
font-family: "Roboto Mono", Monaco, courier, monospace;
font-weight: 400;
font-size: .875rem;

&.router-link-exact-active {
font-weight: 500;
}
}
}

Expand Down

0 comments on commit 94c6c59

Please sign in to comment.