Skip to content

Commit b99e0e4

Browse files
authored
Merge pull request #14 from metalabdesign/remove-router-integration
Remove React Router integration.
2 parents ba6b0ef + 05855b1 commit b99e0e4

6 files changed

Lines changed: 4 additions & 142 deletions

File tree

src/connect.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,6 @@ export default ({scope, ...defaultProps} = {}) => (WrappedComponent) => {
3232
router: PropTypes.object,
3333
}
3434

35-
navigateToPath(path) {
36-
// Check for the react-router context.
37-
if (!this.context.router) {
38-
return;
39-
}
40-
41-
this.context.router.push(path);
42-
}
43-
4435
render() {
4536
const {components, renderMap} = this.props.___relocationState___;
4637
const {
@@ -56,9 +47,7 @@ export default ({scope, ...defaultProps} = {}) => (WrappedComponent) => {
5647
...component,
5748
render: renderMap[component.type],
5849
update: (props) => updateComponent(component.id, props),
59-
remove: typeof component.removePath === 'string'
60-
? () => this.navigateToPath(component.removePath)
61-
: () => removeComponent(component.id),
50+
remove: () => removeComponent(component.id),
6251
};
6352

6453
if (scope) {

src/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ export {ADD_COMPONENT, REMOVE_COMPONENT} from './action';
22
export {addComponent, removeComponent} from './action';
33
export {default as relocation} from './connect';
44
export {default as reducer} from './reducer';
5-
export {default as createRelocationRouter} from './router';
65
export {default} from './connect';

src/reducer.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
SET_COMPONENT,
55
UPDATE_COMPONENT,
66
REMOVE_COMPONENT,
7-
SET_ROUTE_COMPONENTS,
87
} from './action';
98

109
export default combineReducers({
@@ -25,9 +24,4 @@ export default combineReducers({
2524
state.filter((item) => item.id !== payload.id),
2625

2726
}[action.type] || (() => state))(state, action),
28-
29-
routeComponents: (state = [], action) =>
30-
action.type === SET_ROUTE_COMPONENTS
31-
? action.payload
32-
: state,
3327
});

src/router.js

Lines changed: 0 additions & 111 deletions
This file was deleted.

src/selector.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,5 @@ export const getRelocation = (state, props) =>
33
? props.getRelocationState(state, props)
44
: state.relocation;
55

6-
export const getComponents = (state, props) => {
7-
const routeComponents = getRelocation(state, props).routeComponents;
8-
const components = getRelocation(state, props).components;
9-
10-
// Concat components and route components uniquely by id.
11-
return routeComponents
12-
.filter(({id: routeId}) =>
13-
!components.filter(({id}) => id === routeId).length
14-
)
15-
.concat(components);
16-
};
6+
export const getComponents = (state, props) =>
7+
getRelocation(state, props).components;

src/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const componentShape = PropTypes.shape({
1515
scope: PropTypes.string,
1616
props: PropTypes.object,
1717
remove: PropTypes.func,
18-
removePath: PropTypes.string,
18+
update: PropTypes.func,
1919
render: renderShape,
2020
});
2121

0 commit comments

Comments
 (0)