-
Notifications
You must be signed in to change notification settings - Fork 36
/
ReactGoogleMaps.jsx
45 lines (41 loc) · 1.2 KB
/
ReactGoogleMaps.jsx
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
import _ from "lodash";
import React from "react";
import { compose, withProps } from "recompose";
import {
withScriptjs,
withGoogleMap,
GoogleMap,
Marker
} from "react-google-maps";
import GitHubForkRibbon from "react-github-fork-ribbon";
import Header from "../../Header";
const MyMapComponent = compose(
withProps({
googleMapURL:
"https://maps.googleapis.com/maps/api/js?key=AIzaSyC4R6AN7SmujjPUIGKdyao2Kqitzr1kiRg&v=3.exp&libraries=geometry,drawing,places",
loadingElement: <div style={{ height: `100%` }} />,
containerElement: <div style={{ height: `400px` }} />,
mapElement: <div style={{ height: `100%` }} />
}),
withScriptjs,
withGoogleMap
)(props => (
<GoogleMap defaultZoom={8} defaultCenter={{ lat: -34.397, lng: 150.644 }}>
<Marker position={{ lat: -34.397, lng: 150.644 }} />
</GoogleMap>
));
const enhance = _.identity;
const ReactGoogleMaps = () => [
<Header key="header" />,
<GitHubForkRibbon
key="ribbon"
href="https://github.com/tomchentw/react-google-maps"
target="_blank"
rel="noopener noreferrer"
position="right"
>
Fork me on GitHub
</GitHubForkRibbon>,
<MyMapComponent key="map" />
];
export default enhance(ReactGoogleMaps);