Vulcan/packages/base-components/lib/common/App.jsx

40 lines
840 B
React
Raw Normal View History

import React, { PropTypes, Component } from 'react';
2016-03-27 16:32:29 +09:00
import Core from "meteor/nova:core";
const AppComposer = Core.AppComposer;
class App extends Component {
2016-03-24 18:17:35 +09:00
getChildContext() {
2016-03-24 18:17:35 +09:00
return {
currentUser: this.props.currentUser,
currentRoute: this.props.currentRoute
2016-03-24 18:17:35 +09:00
};
}
render() {
2016-02-16 15:08:30 +09:00
({Layout, AppLoading} = Telescope.components);
2016-02-16 15:08:30 +09:00
if (this.props.ready) {
return <Layout currentUser={this.props.currentUser}>{this.props.content}</Layout>
2016-02-16 15:08:30 +09:00
} else {
return <AppLoading />
2016-02-16 15:08:30 +09:00
}
}
}
App.propTypes = {
ready: React.PropTypes.bool,
currentUser: React.PropTypes.object,
currentRoute: React.PropTypes.object
}
App.childContextTypes = {
currentUser: React.PropTypes.object,
currentRoute: React.PropTypes.object
}
2016-03-27 16:32:29 +09:00
module.exports = AppComposer(App);
export default AppComposer(App);