-
Notifications
You must be signed in to change notification settings - Fork 943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mapbox Map component #896
Mapbox Map component #896
Conversation
7ffe33d
to
63dbca9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Check the comments and remember to add a changelog entry.
return markerOverlay(center); | ||
}; | ||
|
||
class StaticMapboxMap extends Component { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be a functional component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I can change to a function. But always creating a class also has the upside of not having to indent the whole component (and generating lots of diff) when it required state of lifecycle methods.
src/components/Map/Map.js
Outdated
@@ -3,7 +3,8 @@ import { bool, number, object, string } from 'prop-types'; | |||
import classNames from 'classnames'; | |||
import { propTypes } from '../../util/types'; | |||
import config from '../../config'; | |||
import { StaticMap, DynamicMap, isMapsLibLoaded } from './GoogleMap'; | |||
// import { StaticMap, DynamicMap, isMapsLibLoaded } from './GoogleMap'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment something we'd leave to the code as an example on how to change the map implementation. Or remove when the map migration is complete?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, the Mapbox one should be commented out and the Google one in use. I'll fix that.
I'd leave the Mapbox imports as comments so we can easily test those while doing the whole map provider migration. We can decide to drop them when putting it all together in the end.
@@ -45,8 +45,10 @@ export class Map extends Component { | |||
/> | |||
) : ( | |||
<DynamicMap | |||
containerElement={<div className={classes} onClick={this.onMapClicked} />} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where has the onClick
gone?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wasn't used at all, there wasn't even a onMapClicked
method that it was calling. It was probably copy pasted from SearchMap
that had such method.
This page implements a version of the
Map
component (used inListingPage
) using Mapbox.Screenshots
Static map with marker
Dynamic map with marker
Static map with custom marker
Dynamic map with custom marker
Static map with fuzzy location circle
Dynamic map with fuzzy location circle