-
Notifications
You must be signed in to change notification settings - Fork 4.1k
/
Copy pathApp.js
46 lines (40 loc) · 1.25 KB
/
App.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
import React from 'react'
import { hot } from 'react-hot-loader/root'
import { Route, Router, withSiteData } from 'react-static'
import { Switch } from 'react-router'
import Routes from 'react-static-routes'
import Sidebar from './components/Sidebar/Sidebar'
import style from './Style'
import { docTypes } from './utils'
const App = ({ componentMenu, versions }) => (
<div style={style.container}>
<Router>
<>
<Switch>
{/*
* We can't place <Sidebar /> inside of <Routes /> because it will be remounted on page
* switch. We also don't want to show <Sidebar /> for layouts pages and maximized pages.
*/}
<Route exact path='/layouts/:name' component={null} />
<Route path='/maximize/*' component={null} />
<Route path='/'>
{(props) => (
<Sidebar
{...props}
componentMenu={componentMenu}
style={style.menu}
version={versions.suir}
/>
)}
</Route>
</Switch>
<Routes />
</>
</Router>
</div>
)
App.propTypes = {
componentMenu: docTypes.componentMenu.isRequired,
versions: docTypes.versions,
}
export default hot(withSiteData(App))