1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 09:23:13 +01:00

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

View File

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