Last active
August 4, 2016 18:09
-
-
Save roblingle/0b2e68f31364d820a9fb9dcb0e2418a4 to your computer and use it in GitHub Desktop.
MuiThemeWrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* MuiThemeWrapper.js | |
* | |
* Simplifies Material-UI React components when you don't have a single top-level component, | |
* which is common in Rails and Meteor where you're including components in pages as needed. | |
* | |
*/ | |
import React, { Component } from 'react'; | |
import {deepOrange500} from 'material-ui/styles/colors'; | |
import getMuiTheme from 'material-ui/styles/getMuiTheme'; | |
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; | |
const muiTheme = getMuiTheme({ | |
palette: { | |
accent1Color: deepOrange500 | |
}, | |
}); | |
// See https://gist.github.com/sebmarkbage/ef0bf1f338a7182b6775 | |
export var MuiThemeWrapper = ComposedComponent => class extends Component { | |
// componentDidMount(){ | |
// console.log('Mounted and enhanced!'); | |
// } | |
render(){ | |
return ( | |
<MuiThemeProvider muiTheme={muiTheme}> | |
<ComposedComponent {...this.props} /> | |
</MuiThemeProvider> | |
); | |
} | |
} |
Author
roblingle
commented
Aug 4, 2016
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment