WIP <Compose> Refactor; <Drawer> ed.

This commit is contained in:
kibigo!
2017-12-26 16:54:28 -08:00
parent 924ffe81d4
commit 3c29f57404
18 changed files with 723 additions and 455 deletions

View File

@@ -1,3 +1,6 @@
import { injectIntl } from 'react-intl';
import { connect } from 'react-redux';
// Merges react-redux props.
export function mergeProps (stateProps, dispatchProps, ownProps) {
Object.assign({}, ownProps, {
@@ -5,3 +8,9 @@ export function mergeProps (stateProps, dispatchProps, ownProps) {
state: Object.assign({}, stateProps, ownProps.state || {}),
});
}
// Connects a component.
export function wrap (Component, mapStateToProps, mapDispatchToProps, options) {
const withIntl = typeof options === 'object' ? options.withIntl : !!options;
return (withIntl ? injectIntl : i => i)(connect(mapStateToProps, mapDispatchToProps, mergeProps)(Component));
}