* add with-theme hoc * add dark theme styles for components * add toggle theme button to the dev demo page * add info about widget themes to README
17 lines
354 B
React
17 lines
354 B
React
/** @jsx h */
|
|
import { h } from 'preact';
|
|
import store from 'common/store';
|
|
|
|
const withTheme = PlainComponent => {
|
|
const ThemedComponent = props => {
|
|
const { mods = {} } = props;
|
|
const theme = store.get('theme');
|
|
|
|
return <PlainComponent {...props} mods={{ theme, ...mods }} />;
|
|
};
|
|
|
|
return ThemedComponent;
|
|
};
|
|
|
|
export default withTheme;
|