-
Notifications
You must be signed in to change notification settings - Fork 32
/
SubContainer.js
45 lines (43 loc) · 1.29 KB
/
SubContainer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
var s = require('react-prefixr');
var React = require('react');
var SubContainer = React.createClass({
displayName: 'Sub-Infinity',
getInitialState: function () {
return {
transform: this.props.transform + ' scale(1)',
opacity: '0'
};
},
componentDidMount: function (argument) {
this.setState({transform: this.props.transform + ' scale(1)', opacity: '1'});
},
componentWillReceiveProps: function (newProps) {
this.setState({transform: newProps.transform + ' scale(1)'});
},
componentWillEnter: function (cb) {
this.setState({transform: this.props.transform + ' scale(1)', opacity: '0'});
setTimeout(cb, 100);
},
componentDidEnter: function () {
this.setState({transform: this.props.transform + ' scale(1)', opacity: '1'});
},
componentWillLeave: function (cb) {
this.setState({transform: this.props.transform + ' scale(1)', opacity: '0'});
setTimeout(cb, 400);
},
render: function () {
return React.DOM.div({style: s({
position: 'absolute',
top: '0',
left: '0',
transform: this.state.transform,
width: this.props.width,
height: this.props.height,
transition: this.props.transition,
opacity: this.state.opacity
})},
this.props.children
);
}
});
module.exports = SubContainer;