Skip to content

Commit 3f4980e

Browse files
committed
Remove recompose dependency
1 parent a0b7b92 commit 3f4980e

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
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",

src/with-theme.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
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

816
export default withTheme

0 commit comments

Comments
 (0)