-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a simple google map component
- Loading branch information
1 parent
321cad3
commit b04f5c3
Showing
4 changed files
with
52 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
module.exports = { | ||
"env": { | ||
"browser": true, | ||
"es6": true, | ||
env: { | ||
browser: true, | ||
es6: true, | ||
}, | ||
"plugins": [ | ||
"react", | ||
], | ||
"globals": { | ||
"graphql": false, | ||
plugins: ['react'], | ||
globals: { | ||
graphql: false, | ||
}, | ||
"parserOptions": { | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"experimentalObjectRestSpread": true, | ||
"jsx": true, | ||
parser: 'babel-eslint', | ||
parserOptions: { | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
experimentalObjectRestSpread: true, | ||
jsx: true, | ||
}, | ||
} | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react' | ||
import GoogleMapReact from 'google-map-react' | ||
|
||
const AnyReactComponent = ({ text }) => <div>{text}</div> | ||
|
||
class SimpleMap extends React.Component { | ||
static defaultProps = { | ||
center: { | ||
lat: 59.95, | ||
lng: 30.33, | ||
}, | ||
zoom: 11, | ||
} | ||
|
||
render() { | ||
return ( | ||
// Important! Always set the container height explicitly | ||
<div style={{ height: '100vh', width: '100%' }}> | ||
<GoogleMapReact | ||
bootstrapURLKeys={{ key: '' }} | ||
defaultCenter={this.props.center} | ||
defaultZoom={this.props.zoom} | ||
> | ||
<AnyReactComponent | ||
lat={59.955413} | ||
lng={30.337844} | ||
text={'Kreyser Avrora'} | ||
/> | ||
</GoogleMapReact> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default SimpleMap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters