mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
Remove obsolete AppRouteWrapper
Now that currentUser and whitelabel are passed as context, we don’t need AppRouteWrapper to copy them into routes as props
This commit is contained in:
parent
4683ae6b17
commit
75247b2594
@ -1,34 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import { omitFromObject } from '../utils/general_utils';
|
||||
|
||||
const AppRouteWrapper = React.createClass({
|
||||
propTypes: {
|
||||
children: React.PropTypes.oneOfType([
|
||||
React.PropTypes.arrayOf(React.PropTypes.element),
|
||||
React.PropTypes.element
|
||||
]).isRequired
|
||||
},
|
||||
|
||||
render() {
|
||||
const propsToPropagate = omitFromObject(this.props, ['children']);
|
||||
|
||||
let childrenWithProps = this.props.children;
|
||||
// If there are more props given, propagate them into the child routes by cloning the routes
|
||||
if (Object.keys(propsToPropagate).length) {
|
||||
childrenWithProps = React.Children.map(this.props.children, (child) => {
|
||||
return React.cloneElement(child, propsToPropagate);
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="container ascribe-body">
|
||||
{childrenWithProps}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default AppRouteWrapper;
|
@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import AppBase from './app_base';
|
||||
import AppRouteWrapper from './app_route_wrapper';
|
||||
import Footer from './footer';
|
||||
import Header from './header';
|
||||
|
||||
@ -20,10 +19,10 @@ const AscribeApp = React.createClass({
|
||||
return (
|
||||
<div className="ascribe-app ascribe-default-app">
|
||||
<Header routes={routes} />
|
||||
<AppRouteWrapper>
|
||||
<div className="container ascribe-body">
|
||||
{/* Routes are injected here */}
|
||||
{children}
|
||||
</AppRouteWrapper>
|
||||
</div>
|
||||
{showFooter ? <Footer /> : null}
|
||||
</div>
|
||||
);
|
||||
|
@ -3,7 +3,6 @@ import withRouter from 'react-router/es6/withRouter';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import AppBase from '../../app_base';
|
||||
import AppRouteWrapper from '../../app_route_wrapper';
|
||||
import Header from '../../header';
|
||||
|
||||
import { getSubdomain } from '../../../utils/general_utils';
|
||||
@ -39,10 +38,10 @@ let WalletApp = React.createClass({
|
||||
return (
|
||||
<div className={classNames('ascribe-app', 'ascribe-wallet-app', `route--${(path ? path.split('/')[0] : 'landing')}`)}>
|
||||
{header}
|
||||
<AppRouteWrapper>
|
||||
<div className="container ascribe-body">
|
||||
{/* Routes are injected here */}
|
||||
{children}
|
||||
</AppRouteWrapper>
|
||||
</div>
|
||||
{Footer ? <Footer /> : null}
|
||||
</div>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user