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

Commit

Permalink
feat(card): Synchronise with mdc-web v0.31.0 (add primary action)
Browse files Browse the repository at this point in the history
  • Loading branch information
matsp committed Feb 20, 2018
1 parent 28a7aac commit ac51092
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
17 changes: 14 additions & 3 deletions components/Card/Card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
<div
class="mdc-card"
:class="classes">
<slot name="media"/>
<slot />
<div :class="contentClasses">
<slot name="media"/>
<slot />
</div>
<div
class="mdc-card__actions"
:class="actionClasses"
Expand Down Expand Up @@ -32,6 +34,10 @@ export default {
fullBleedAction: {
type: Boolean,
default: false
},
primaryAction: {
type: Boolean,
default: false
}
},
computed: {
Expand All @@ -40,13 +46,18 @@ export default {
'mdc-card--stroked': this.stroked
}
},
contentClasses () {
return {
'mdc-card__primary-action': this.primaryAction
}
},
actionClasses () {
return {
'mdc-card__actions--full-bleed': this.fullBleedAction
}
}
},
mounted () {
mounted () {
if (this.$slots.actionButtons) {
this.$slots.actionButtons.map((n) => {
n.elm.classList.add('mdc-card__action')
Expand Down
3 changes: 2 additions & 1 deletion components/Card/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
### Markup

```html
<m-card>
<m-card primaryAction>
<m-typo-headline class="demo">
Title
</m-typo-headline>
Expand Down Expand Up @@ -37,6 +37,7 @@
|------|------|---------|-------------|
| stroked | Boolean | false | renders a hairline stroke |
| fullBleedAction | Boolean | false | a single action will take up the entire space in the row |
| primaryAction | Boolean | false | visual support for a primary action on the card |

### Slots

Expand Down
2 changes: 1 addition & 1 deletion demo/views/CardView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</m-typo-body>
</m-layout-grid-cell>
<m-layout-grid-cell>
<m-card>
<m-card primaryAction>
<m-typo-headline class="demo">
Title
</m-typo-headline>
Expand Down

0 comments on commit ac51092

Please sign in to comment.