-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathroot.component.js
51 lines (49 loc) · 1.6 KB
/
root.component.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import React from "react";
import { Route } from "react-router";
import { BrowserRouter } from "react-router-dom";
import LazyRoute from "./lazy-route.component.js";
import Navbar from "./navbar/navbar.component.js";
import styleguide from "./styleguide.js";
import { Scoped } from "kremling";
import I18N from "./i18n.component.js";
import withAuthentication from "./authentication.component.js";
import About from "./about/about.component.js";
import NotFound from "./not-found/not-found.component";
class Root extends React.Component {
render() {
return (
<I18N>
{({ baseUrl, currentLanguage, translations }) => (
<Scoped css={styleguide}>
<div>
<BrowserRouter basename={baseUrl}>
<>
<Route children={props => <Navbar {...props} />} />
<Route path="/about" component={About} />
<LazyRoute
exact
path="/"
loadRoute={() =>
import(
/* webpackChunkName: "home" */ "./home/home.component.js"
)
}
/>
<LazyRoute
path="/app"
loadRoute={() =>
import(
/* webpackChunkName: "app" */ "./app/app.component.js"
)
}
/>
</>
</BrowserRouter>
</div>
</Scoped>
)}
</I18N>
);
}
}
export default withAuthentication(Root);