Skip to content

Commit

Permalink
feat(md-navbar): add auto-height style
Browse files Browse the repository at this point in the history
  • Loading branch information
Thanood committed Nov 20, 2016
1 parent 823cc38 commit a9687cf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/navbar/navbar.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
md-navbar .primary {
transition: all .3s ease-out;
}

md-navbar .primary.md-auto-height {
height: auto;
}
2 changes: 1 addition & 1 deletion src/navbar/navbar.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<require from="./navbar.css"></require>
<div ref="fixedAnchor">
<nav class="primary">
<nav class="primary" ref="nav">
<div class="nav-wrapper">
<slot></slot>
</div>
Expand Down
10 changes: 10 additions & 0 deletions src/navbar/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export class MdNavbar {
@bindable({
defaultBindingMode: bindingMode.oneTime
}) mdFixed;
@bindable({
defaultBindingMode: bindingMode.oneTime
}) mdAutoHeight;
fixedAttributeManager;

constructor(element) {
Expand All @@ -18,14 +21,21 @@ export class MdNavbar {

attached() {
this.fixedAttributeManager = new AttributeManager(this.fixedAnchor);
this.navAttributeManager = new AttributeManager(this.nav);
if (getBooleanFromAttributeValue(this.mdFixed)) {
this.fixedAttributeManager.addClasses('navbar-fixed');
}
if (getBooleanFromAttributeValue(this.mdAutoHeight)) {
this.navAttributeManager.addClasses('md-auto-height');
}
}

detached() {
if (getBooleanFromAttributeValue(this.mdFixed)) {
this.fixedAttributeManager.removeClasses('navbar-fixed');
}
if (getBooleanFromAttributeValue(this.mdAutoHeight)) {
this.navAttributeManager.addClasses('md-auto-height');
}
}
}

0 comments on commit a9687cf

Please sign in to comment.