Skip to content

Commit 91c90c0

Browse files
Shaurya Arorayongxu
authored andcommitted
Refactored theme.jsx component from PR [mui#797](mui#797)
Separated out decorator into src/styles/theme-decorator.js so that it no longer relies on another wrapper component.
1 parent 651509a commit 91c90c0

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/styles/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ module.exports = {
77
Typography: require('./typography'),
88
LightRawTheme: require('./raw-themes/light-raw-theme'),
99
DarkRawTheme: require('./raw-themes/dark-raw-theme'),
10+
ThemeDecorator: require('./theme-decorator'),
1011
};

src/styles/theme-decorator.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const React = require('react');
2+
3+
module.exports = (customTheme) => {
4+
5+
return function(Component) {
6+
7+
return React.createClass({
8+
9+
childContextTypes : {
10+
muiTheme: React.PropTypes.object,
11+
},
12+
13+
getChildContext () {
14+
return {
15+
muiTheme: customTheme,
16+
};
17+
},
18+
19+
render() {
20+
return React.createElement(Component, null);
21+
},
22+
});
23+
24+
};
25+
}

0 commit comments

Comments
 (0)