File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 2929 },
3030 "homepage" : " https://github.com/team-767/react-with-theme#readme" ,
3131 "dependencies" : {
32- "recompose" : " >= 0.17.0 < 2"
3332 },
3433 "devDependencies" : {
3534 "babel-cli" : " ^6.6.5" ,
Original file line number Diff line number Diff line change 1- import mapProps from 'recompose/mapProps '
1+ import React from 'react '
22
3- const withTheme = ( { themes, transform } ) => ( BaseComponent ) =>
4- mapProps (
5- ( props ) => ( { ...props , ...transform ( themes [ props . theme ] || themes . default ) } )
6- ) ( BaseComponent )
3+ const defaults = {
4+ themes : { } ,
5+ transform : ( theme ) => ( { theme } ) ,
6+ }
7+
8+ const withTheme = ( {
9+ themes = defaults . theme ,
10+ transform = defaults . transform ,
11+ } ) => ( BaseComponent ) =>
12+ ( { theme, ...props } ) => ( // eslint-disable-line
13+ < BaseComponent { ...{ ...props , ...transform ( themes [ theme ] || themes . default ) } } />
14+ )
715
816export default withTheme
You can’t perform that action at this time.
0 commit comments