mirror of
https://github.com/plausible/analytics.git
synced 2025-01-03 07:08:04 +03:00
17 lines
391 B
JavaScript
17 lines
391 B
JavaScript
|
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>
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
}
|