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

Commit

Permalink
feat(top-app-bar): Synchronise with mdc-web (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
matsp committed Apr 24, 2018
1 parent ae60fb8 commit e8d5e5a
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 2 deletions.
25 changes: 25 additions & 0 deletions components/top-app-bar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,31 @@ in the navigation slot!
| navigation | navigation section icons |
| actions | actions section icons |

## TopAppBarFixedAdjust

### Markup

```html
<m-top-app-bar-fixed-adjust dense>
Some content
</m-top-app-bar-fixed-adjust>
```

### Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| short | Boolean | false | content adjustment for short top-app-bar |
| dense | Boolean | false | content adjustment for dense top-app-bar |
| prominent | Boolean | false | content adjustment for prominent top-app-bar |
| denseProminent | Boolean | false | content adjustment for dense and prominent top-app-bar |

### Slots

| Slot | Description |
|------|-------------|
| default | content |

### Reference

- https://github.com/material-components/material-components-web/tree/master/packages/mdc-top-app-bar
7 changes: 6 additions & 1 deletion components/top-app-bar/TopAppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ export default {
dense: {
type: Boolean,
default: false
},
fixed: {
type: Boolean,
default: false
}
},
data () {
Expand All @@ -61,7 +65,8 @@ export default {
'mdc-top-app-bar--short': this.short,
'mdc-top-app-bar--short-collapsed': this.collapsed && this.short,
'mdc-top-app-bar--prominent': this.prominent && !this.short,
'mdc-top-app-bar--dense': this.dense && !this.short
'mdc-top-app-bar--dense': this.dense && !this.short,
'mdc-top-app-bar--fixed': this.fixed && !this.short
}
}
},
Expand Down
40 changes: 40 additions & 0 deletions components/top-app-bar/TopAppBarFixedAdjust.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<div
class="mdc-top-app-bar--fixed-adjust"
:class="classes">
<slot />
</div>
</template>

<script>
export default {
props: {
dense: {
type: Boolean,
default: false
},
short: {
type: Boolean,
default: false
},
prominent: {
type: Boolean,
default: false
},
denseProminent: {
type: Boolean,
default: false
}
},
computed: {
classes () {
return {
'mdc-top-app-bar--dense-fixed-adjust': this.dense && !this.short,
'mdc-top-app-bar--short-fixed-adjust': this.short,
'mdc-top-app-bar--prominent-fixed-adjust': this.prominent && !this.short,
'mdc-top-app-bar--dense-prominent-fixed-adjust': this.denseProminent && !this.short,
}
}
}
}
</script>
2 changes: 2 additions & 0 deletions components/top-app-bar/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import TopAppBar from './TopAppBar.vue'
import TopAppBarFixedAdjust from './TopAppBarFixedAdjust.vue'
import './styles.scss'

import { initPlugin } from '../'

const plugin = {
install (vm) {
vm.component('m-top-app-bar', TopAppBar)
vm.component('m-top-app-bar-fixed-adjust', TopAppBarFixedAdjust)
}
}
export default plugin
Expand Down
2 changes: 1 addition & 1 deletion demo/views/TopAppBarView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<m-layout-grid-cell :span="12">
<m-typo-title>Normal</m-typo-title>
<m-layout-grid-inner>
<m-layout-grid-cell :span="8">
<m-layout-grid-cell :span="6">
<m-top-app-bar>
<m-icon
icon="menu"
Expand Down

0 comments on commit e8d5e5a

Please sign in to comment.