2016-08-10 21:36:11 +02:00
|
|
|
/**
|
|
|
|
* Root component to render, setting locale, messages, Router and Store.
|
|
|
|
*/
|
2016-07-07 23:23:18 +02:00
|
|
|
import React, { Component, PropTypes } from "react";
|
|
|
|
import { Provider } from "react-redux";
|
|
|
|
import { Router } from "react-router";
|
2016-07-28 01:22:48 +02:00
|
|
|
import { IntlProvider } from "react-intl";
|
2016-07-07 23:23:18 +02:00
|
|
|
|
|
|
|
import routes from "../routes";
|
|
|
|
|
|
|
|
export default class Root extends Component {
|
|
|
|
render() {
|
2016-08-03 22:31:11 +02:00
|
|
|
const { locale, messages, defaultLocale, store, history, render } = this.props;
|
2016-07-07 23:23:18 +02:00
|
|
|
return (
|
|
|
|
<Provider store={store}>
|
2016-07-28 01:22:48 +02:00
|
|
|
<IntlProvider locale={locale} messages={messages} defaultLocale={defaultLocale}>
|
2016-08-03 22:31:11 +02:00
|
|
|
<Router history={history} routes={routes} render={render} />
|
2016-07-28 01:22:48 +02:00
|
|
|
</IntlProvider>
|
2016-07-07 23:23:18 +02:00
|
|
|
</Provider>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Root.propTypes = {
|
|
|
|
store: PropTypes.object.isRequired,
|
2016-07-28 01:22:48 +02:00
|
|
|
history: PropTypes.object.isRequired,
|
2016-08-03 22:31:11 +02:00
|
|
|
render: PropTypes.func,
|
2016-07-28 01:22:48 +02:00
|
|
|
locale: PropTypes.string.isRequired,
|
|
|
|
messages: PropTypes.object.isRequired,
|
2016-08-10 23:50:23 +02:00
|
|
|
defaultLocale: PropTypes.string.isRequired,
|
2016-07-07 23:23:18 +02:00
|
|
|
};
|