Fix Footer rendering from route declarations

Also a few cosmetic changes to make it more obvious the route holds an
actual footer type.
This commit is contained in:
Brett Sun 2016-06-10 10:23:45 +02:00
parent df1e6a55c4
commit 2aa3aa5ff7
2 changed files with 6 additions and 7 deletions

View File

@ -1,7 +1,6 @@
import React from 'react';
import AppBase from './app_base';
import Footer from './footer';
import Header from './header';
@ -9,12 +8,12 @@ const AscribeApp = React.createClass({
propTypes: {
activeRoute: React.PropTypes.object.isRequired,
children: React.PropTypes.element.isRequired,
routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired
},
render() {
const { activeRoute, children, routes } = this.props;
const showFooter = activeRoute && activeRoute.footer;
const RouteFooterType = activeRoute && activeRoute.footer;
return (
<div className="ascribe-app ascribe-default-app">
@ -23,7 +22,7 @@ const AscribeApp = React.createClass({
{/* Routes are injected here */}
{children}
</div>
{showFooter ? <Footer /> : null}
{RouteFooterType ? <RouteFooterType /> : null}
</div>
);
}

View File

@ -16,14 +16,14 @@ let WalletApp = React.createClass({
routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
// Injected through HOCs
router: routerShape.isRequired,
router: routerShape.isRequired // eslint-disable-line react/sort-prop-types
},
render() {
const { activeRoute, children, router, routes } = this.props;
const subdomain = getSubdomain();
const path = activeRoute && activeRoute.path;
const Footer = activeRoute && activeRoute.footer;
const RouteFooterType = activeRoute && activeRoute.footer;
let header = null;
// if the path of the current activeRoute is not defined, then this is the IndexRoute
@ -45,7 +45,7 @@ let WalletApp = React.createClass({
{/* Routes are injected here */}
{children}
</div>
{Footer ? <Footer /> : null}
{RouteFooterType ? <RouteFooterType /> : null}
</div>
);
}