Download tabler-react/example/src/GoogleMap/GoogleMap.react.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 950 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/tabler-react/example/src/GoogleMap/GoogleMap.react.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/tabler-react/example/src/GoogleMap/GoogleMap.react.js
-
curl -L -o GoogleMap.react.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/tabler-react/example/src/GoogleMap/GoogleMap.react.js
950 Bytes
| // @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; | |