-
Notifications
You must be signed in to change notification settings - Fork 816
/
Copy pathContainer.js
92 lines (79 loc) · 2.44 KB
/
Container.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import React, {Component} from 'react';
import GitHubForkRibbon from 'react-github-fork-ribbon';
import PropTypes from 'prop-types';
import {withRouter, Switch, Link, Redirect, Route} from 'react-router-dom';
import styles from './styles.module.css';
const GoogleApiWrapper = __IS_DEV__
? require('../src/index').GoogleApiWrapper
: require('../dist').GoogleApiWrapper;
class Container extends Component {
static propTypes = {};
static contextTypes = {
router: PropTypes.object
};
render() {
const {children, routes, routeDef} = this.props;
return (
<div className={styles.container}>
<GitHubForkRibbon
href="//github.com/fullstackreact/google-maps-react"
position="right"
target="_blank"
>
Fork me on GitHub
</GitHubForkRibbon>
<div className={styles.wrapper}>
<div className={styles.list}>
<ul>
{routes.map(route => (
<Link key={route.path} to={route.path}>
<li>{route.name}</li>
</Link>
))}
</ul>
</div>
<div className={styles.content}>
<div className={styles.header}>
<h1>{routeDef && routeDef.name} Example</h1>
<h2>
<a href="https://github.com/fullstackreact/google-maps-react/blob/master/README.md">
Readme
</a>
</h2>
</div>
<div className={styles.mapContainer}>
<Switch>
{routes.map(route => (
<Route
key={route.name}
path={route.path}
routeDef={route}
routes={routes}
render={routingProps => (
<div>
<route.component
{...routingProps}
google={this.props.google}
loaded={this.props.loaded}
/>
</div>
)}
/>
))}
<Redirect path="*" to={'/basic'} />
</Switch>
</div>
</div>
</div>
</div>
);
}
}
const Loading = () => <div>Fancy loading container</div>;
export default withRouter(
GoogleApiWrapper({
apiKey: __GAPI_KEY__,
libraries: ['places', 'visualization'],
LoadingContainer: Loading
})(Container)
);