diff --git a/src/js/left-nav.jsx b/src/js/left-nav.jsx index 71c677b5890df1..864a510c7b230d 100644 --- a/src/js/left-nav.jsx +++ b/src/js/left-nav.jsx @@ -2,6 +2,7 @@ var React = require('react'), KeyCode = require('./utils/key-code.js'), Classable = require('./mixins/classable.js'), WindowListenable = require('./mixins/window-listenable.js'), + Overlay = require('./overlay.jsx'), Paper = require('./paper.jsx'), Menu = require('./menu.jsx'); @@ -50,11 +51,7 @@ var LeftNav = React.createClass({ selectedIndex = this.props.selectedIndex, overlay; - if (!this.props.docked) { - overlay = ( -
- ); - } + if (!this.props.docked) overlay = ; return (
diff --git a/src/js/overlay.jsx b/src/js/overlay.jsx new file mode 100644 index 00000000000000..3e8fc22a7df623 --- /dev/null +++ b/src/js/overlay.jsx @@ -0,0 +1,29 @@ +var React = require('react'), + Classable = require('./mixins/classable.js'); + +var Overlay = React.createClass({ + + mixins: [Classable], + + propTypes: { + show: React.PropTypes.bool + }, + + render: function() { + var + { + className, + ...other + } = this.props, + classes = this.getClasses('mui-overlay', { + 'mui-is-shown': this.props.show + }); + + return ( +
+ ); + } + +}); + +module.exports = Overlay; \ No newline at end of file diff --git a/src/less/components/components.less b/src/less/components/components.less index 30f1296e4db052..cb86064aa8f51a 100644 --- a/src/less/components/components.less +++ b/src/less/components/components.less @@ -12,6 +12,7 @@ @import "input.less"; @import "left-nav.less"; @import "menu.less"; +@import "overlay.less"; @import "paper.less"; @import "paper-button.less"; @import "radio-button.less"; diff --git a/src/less/components/left-nav.less b/src/less/components/left-nav.less index 75aeb7f7292d2a..427726ef09f26c 100644 --- a/src/less/components/left-nav.less +++ b/src/less/components/left-nav.less @@ -1,17 +1,5 @@ .mui-left-nav { - .mui-overlay { - position: fixed; - height: 100%; - width: 100%; - z-index: 9; - - background-color: @light-black; - left: 0px; - top: 0px; - .lh-transition(left 0ms @ease-out-function 0ms, background-color 400ms @ease-out-function 0ms); - } - .mui-left-nav-menu { height: 100%; position: fixed; @@ -36,17 +24,8 @@ } &.mui-closed { - - .mui-overlay { - left: -100%; - background-color: rgba(0, 0, 0, 0); - - .lh-transition(left 0ms @ease-out-function 400ms, background-color 400ms @ease-out-function 0ms); - } - .mui-left-nav-menu { .lh-translate3d((-1 * @left-nav-width) - 10px, 0, 0); } - } -} +} \ No newline at end of file diff --git a/src/less/components/overlay.less b/src/less/components/overlay.less new file mode 100644 index 00000000000000..9be6aaa7cd550a --- /dev/null +++ b/src/less/components/overlay.less @@ -0,0 +1,17 @@ +.mui-overlay { + position: fixed; + height: 100%; + width: 100%; + z-index: 9; + top: 0px; + + left: -100%; + background-color: rgba(0, 0, 0, 0); + .lh-transition(left 0ms @ease-out-function 400ms, background-color 400ms @ease-out-function 0ms); + + &.mui-is-shown { + left: 0px; + background-color: @light-black; + .lh-transition(left 0ms @ease-out-function 0ms, background-color 400ms @ease-out-function 0ms); + } +} \ No newline at end of file