Skip to content
This repository has been archived by the owner on Nov 30, 2020. It is now read-only.

Commit

Permalink
fix(chips): Only render checkmark on filter chips
Browse files Browse the repository at this point in the history
  • Loading branch information
matsp committed May 16, 2018
1 parent 23734b6 commit 37f675d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
15 changes: 11 additions & 4 deletions components/chips/Chip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<slot
name="leadingIcon"
v-if="$slots['leadingIcon']"/>
<div class="mdc-chip__checkmark" >
<div
v-if="mdcChipSet && mdcChipSet.filter"
class="mdc-chip__checkmark">
<svg
class="mdc-chip__checkmark-svg"
viewBox="-2 -3 30 30">
Expand Down Expand Up @@ -45,6 +47,7 @@ export default {
default: false
}
},
inject: ['mdcChipSet'],
data () {
return {
slotObserver: undefined
Expand All @@ -53,8 +56,7 @@ export default {
computed: {
classes () {
return {
'mdc-chip--selected': this.selected,
'mdc-chip__icon--leading-hidden': this.selected
'mdc-chip--selected': this.selected
}
}
},
Expand All @@ -74,7 +76,12 @@ export default {
if (this.$slots.leadingIcon) {
this.$slots.leadingIcon.map((n) => {
n.elm.classList.add('mdc-chip__icon')
n.elm.classList.add('mdc-chip__icon--leading')
if (this.selected) {
n.elm.classList.add('mdc-chip__icon--leading-hidden')
} else {
n.elm.classList.remove('mdc-chip__icon--leading-hidden')
n.elm.classList.add('mdc-chip__icon--leading')
}
})
}
if (this.$slots.trailingIcon) {
Expand Down
10 changes: 8 additions & 2 deletions components/chips/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,23 @@ data() {
|------|------|---------|-------------|
| choice | Boolean | false | single selection chips in set |
| filter | Boolean | false | multiple selection chips in set |
| input | Boolean | false | indicates that the chips in the set are input chips |
| input | Boolean | false | indicates that the chips in the set are input chips (for converting text in a chip) |

## Chip

### Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| selected | Boolean | false | state of chip (could be v-modeled) |

### Slots

| Slot | Description |
|------|-------------|
| default | chip content |
| leadingIcon | leading icon |
| trailingIcon | trailingIcon |
| trailingIcon | trailing icon |

### Reference

Expand Down

0 comments on commit 37f675d

Please sign in to comment.