File size: 950 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
// @flow

import * as React from "react";
import cn from "classnames";

import "./GoogleMap.css";

import {
  withScriptjs,
  withGoogleMap,
  GoogleMap as ReactGoogleMap,
} from "react-google-maps";

const MapComponent: React.ElementType = withScriptjs(
  withGoogleMap(props => (
    <ReactGoogleMap
      defaultZoom={8}
      defaultCenter={{ lat: -34.397, lng: 150.644 }}
      disableDefaultUI={true}
    />
  ))
);

type Props = {|
  +blackAndWhite?: boolean,
|};

function GoogleMap({ blackAndWhite }: Props): React.Node {
  const containerClasses = cn("GoogleMapContainer", { blackAndWhite });
  return (
    <MapComponent
      googleMapURL="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry,drawing,places"
      loadingElement={<div style={{ height: `100%` }} />}
      containerElement={<div className={containerClasses} />}
      mapElement={<div style={{ height: `100%` }} />}
    />
  );
}

export default GoogleMap;