forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp-canvas.jsx
44 lines (34 loc) · 920 Bytes
/
app-canvas.jsx
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
var React = require('react');
var AppCanvas = React.createClass({
contextTypes: {
muiTheme: React.PropTypes.object
},
propTypes: {
predefinedLayout: React.PropTypes.number
},
render: function() {
var styles = {
height: '100%',
backgroundColor: this.context.muiTheme.palette.canvasColor,
WebkitFontSmoothing: 'antialiased'
};
var stylesAppBar = {
position: 'fixed',
height: this.context.muiTheme.component.appBar.height
};
var newChildren = React.Children.map(this.props.children, function(currentChild) {
switch (currentChild.type.displayName) {
case 'AppBar' :
return React.cloneElement(currentChild, {style: stylesAppBar});
default:
return currentChild;
}
}, this);
return (
<div style={styles}>
{newChildren}
</div>
);
}
});
module.exports = AppCanvas;