Skip to content

Commit

Permalink
Added new Map options and header component
Browse files Browse the repository at this point in the history
  • Loading branch information
tsaldanha committed May 26, 2020
1 parent 6417550 commit 3375c58
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
6 changes: 6 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"compilerOptions": {
"baseUrl": "src"
},
"include": ["src"]
}
Empty file added src/components/Header/index.jsx
Empty file.
34 changes: 28 additions & 6 deletions src/components/Map/index.jsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,44 @@
import React from "react";
import { MapContainer } from "./styled";
import { GoogleMap, withScriptjs, withGoogleMap } from "react-google-maps";
import {
GoogleMap,
withScriptjs,
withGoogleMap,
Marker,
BicyclingLayer
} from "react-google-maps";

const MapCenter = {
lat: -23.604710,
lng: -46.634330,
}

const defaultMapOptions = {
fullscreenControl: false,
mapTypeControl: false,
zoomControl: false,
streetViewControl: false,
}

const GMap = () => (
<GoogleMap
defaultZoom={16}
defaultCenter={{ lat: -23.604710, lng: -46.634330}}
/>
defaultCenter={MapCenter}
defaultOptions={defaultMapOptions}
>
<Marker position={MapCenter} />
<BicyclingLayer autoUpdate />
</GoogleMap>
)
const WrappedMap = withScriptjs(withGoogleMap(GMap));

const Map = () => (
<MapContainer>
<WrappedMap
googleMapURL={`https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry,drawing,places&key=${process.env.REACT_APP_GOOGLE_KEY}`}
loadingElement={<div style={{height:`100%`}}/>}
containerElement={<div style={{height:`100%`}}/>}
mapElement={<div style={{height:`100%`}}/>}
loadingElement={<div style={{height:`100vh`}}/>}
containerElement={<div style={{height:`100vh`}}/>}
mapElement={<div style={{height:`100vh`}}/>}
/>
</MapContainer>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Map/styled.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import styled from "styled-components";

export const MapContainer = styled.div`
width: 100vw;
height: 100vw;
height: 100vh;
`;

0 comments on commit 3375c58

Please sign in to comment.