1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +01:00
onion/js/components/ascribe_app.js

45 lines
1.3 KiB
JavaScript
Raw Normal View History

'use strict';
2015-05-13 16:26:12 +02:00
import React from 'react';
2016-02-05 10:38:59 +01:00
import AppBase from './app_base';
import AppRouteWrapper from './app_route_wrapper';
import Footer from './footer';
2016-02-05 10:38:59 +01:00
import Header from './header';
2015-05-18 18:00:12 +02:00
2015-05-20 12:00:16 +02:00
let AscribeApp = React.createClass({
propTypes: {
2016-02-05 10:38:59 +01:00
activeRoute: React.PropTypes.object.isRequired,
children: React.PropTypes.element.isRequired,
2016-01-12 15:05:00 +01:00
routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
2016-02-05 10:38:59 +01:00
// Provided from AppBase
currentUser: React.PropTypes.object,
whitelabel: React.PropTypes.object
},
2015-05-18 18:00:12 +02:00
render() {
2016-02-05 10:38:59 +01:00
const { activeRoute, children, currentUser, routes, whitelabel } = this.props;
2016-03-04 15:53:55 +01:00
const Footer = activeRoute && activeRoute.footer;
2015-05-18 18:00:12 +02:00
return (
<div className="ascribe-app ascribe-default-app">
<Header
currentUser={currentUser}
routes={routes}
whitelabel={whitelabel} />
<AppRouteWrapper
currentUser={currentUser}
whitelabel={whitelabel}>
{/* Routes are injected here */}
{children}
</AppRouteWrapper>
2016-03-04 15:53:55 +01:00
{Footer ? <Footer /> : null}
</div>
2015-05-18 18:00:12 +02:00
);
}
2015-05-20 12:00:16 +02:00
});
2015-05-13 16:26:12 +02:00
2016-02-05 10:38:59 +01:00
export default AppBase(AscribeApp);