-
Notifications
You must be signed in to change notification settings - Fork 314
/
options_map_page.jsx
60 lines (53 loc) · 1.87 KB
/
options_map_page.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* Base Google Map example
*/
import React, {PropTypes, Component} from 'react/addons';
import shouldPureComponentUpdate from 'react-pure-render/function';
import GoogleMap from 'google-map-react';
import MyGreatPlace from './my_great_place.jsx';
function createMapOptions(maps) {
// next props are exposed at maps
// "Animation", "ControlPosition", "MapTypeControlStyle", "MapTypeId",
// "NavigationControlStyle", "ScaleControlStyle", "StrokePosition", "SymbolPath", "ZoomControlStyle",
// "DirectionsStatus", "DirectionsTravelMode", "DirectionsUnitSystem", "DistanceMatrixStatus",
// "DistanceMatrixElementStatus", "ElevationStatus", "GeocoderLocationType", "GeocoderStatus", "KmlLayerStatus",
// "MaxZoomStatus", "StreetViewStatus", "TransitMode", "TransitRoutePreference", "TravelMode", "UnitSystem"
return {
zoomControlOptions: {
position: maps.ControlPosition.RIGHT_CENTER,
style: maps.ZoomControlStyle.SMALL
},
mapTypeControlOptions: {
position: maps.ControlPosition.TOP_RIGHT
},
mapTypeControl: true
};
}
export default class SimpleMapPage extends Component {
static propTypes = {
center: PropTypes.array,
zoom: PropTypes.number,
greatPlaceCoords: PropTypes.any
};
static defaultProps = {
center: [59.938043, 30.337157],
zoom: 9,
greatPlaceCoords: {lat: 59.724465, lng: 30.080121}
};
shouldComponentUpdate = shouldPureComponentUpdate;
constructor(props) {
super(props);
}
render() {
return (
<GoogleMap
// apiKey={YOUR_GOOGLE_MAP_API_KEY} // set if you need stats etc ...
center={this.props.center}
zoom={this.props.zoom}
options={createMapOptions}>
<MyGreatPlace lat={59.955413} lng={30.337844} text={'A'} /* Kreyser Avrora */ />
<MyGreatPlace {...this.props.greatPlaceCoords} text={'B'} /* road circle */ />
</GoogleMap>
);
}
}