|
1 | | -var React = require('react'), |
2 | | - Classable = require('./mixins/classable'); |
| 1 | +var React = require('react'); |
| 2 | +var StylePropable = require('./mixins/style-propable.js'); |
| 3 | +var AutoPrefix = require('./styles/auto-prefix.js'); |
| 4 | +var Transitions = require('./styles/mixins/transitions.js'); |
| 5 | +var Colors = require('./styles/colors.js'); |
3 | 6 |
|
4 | 7 | var Overlay = React.createClass({ |
5 | 8 |
|
6 | | - mixins: [Classable], |
| 9 | + mixins: [StylePropable], |
7 | 10 |
|
8 | 11 | propTypes: { |
9 | 12 | show: React.PropTypes.bool |
10 | 13 | }, |
11 | 14 |
|
12 | 15 | render: function() { |
13 | | - var |
14 | | - { |
15 | | - className, |
16 | | - ...other |
17 | | - } = this.props, |
18 | | - classes = this.getClasses('mui-overlay', { |
19 | | - 'mui-is-shown': this.props.show |
| 16 | + |
| 17 | + var { |
| 18 | + show, |
| 19 | + style, |
| 20 | + ...other |
| 21 | + } = this.props; |
| 22 | + |
| 23 | + var styles = { |
| 24 | + position: 'fixed', |
| 25 | + height: '100%', |
| 26 | + width: '100%', |
| 27 | + zIndex: 9, |
| 28 | + top: 0, |
| 29 | + left: '-100%', |
| 30 | + backgroundColor: Colors.transparent, |
| 31 | + transition: |
| 32 | + Transitions.easeOut('0ms', 'left', '400ms') + ',' + |
| 33 | + Transitions.easeOut('400ms', 'backgroundColor') |
| 34 | + }; |
| 35 | + |
| 36 | + if (this.props.show) { |
| 37 | + styles = this.mergePropStyles(styles, { |
| 38 | + left: 0, |
| 39 | + backgroundColor: Colors.lightBlack, |
| 40 | + transition: |
| 41 | + Transitions.easeOut('0ms', 'left') + ',' + |
| 42 | + Transitions.easeOut('400ms', 'backgroundColor') |
20 | 43 | }); |
| 44 | + } |
| 45 | + |
| 46 | + styles = this.mergePropStyles(styles); |
21 | 47 |
|
22 | 48 | return ( |
23 | | - <div {...other} className={classes} /> |
| 49 | + <div {...other} style={AutoPrefix.all(styles)} /> |
24 | 50 | ); |
25 | 51 | } |
26 | 52 |
|
|
0 commit comments