analytics/assets/js/dashboard/theme-consumer-hoc.js

17 lines
391 B
JavaScript
Raw Normal View History

import React from 'react';
import { ThemeContext } from './theme-context'
export const withThemeConsumer = (WrappedComponent) => {
return class extends React.Component {
render() {
return (
<ThemeContext.Consumer>
{theme => (
<WrappedComponent darkTheme={theme} {...this.props} />
)}
</ThemeContext.Consumer>
);
}
}
}