-
Notifications
You must be signed in to change notification settings - Fork 936
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(marker): add custom label support
* Addition of custom label support for <Marker /> along with examples - Original author: @RGFnaGFuIEd1bmF5 - Original commits: fa96f29, 9aefc2c
- Loading branch information
Showing
7 changed files
with
266 additions
and
31 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
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
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,49 @@ | ||
/* global google */ | ||
|
||
import { | ||
default as React, | ||
Component, | ||
} from "react"; | ||
|
||
import { | ||
withGoogleMap, | ||
GoogleMap, | ||
Marker, | ||
} from "../../../lib"; | ||
|
||
import "./markerWithLabel.css" | ||
|
||
const MarkerWithLabelExampleMap = withGoogleMap(props => ( | ||
<GoogleMap | ||
defaultZoom={3} | ||
defaultCenter={{lat: 25.0391667, lng: 121.525}} | ||
> | ||
<Marker | ||
markerWithLabel={window.MarkerWithLabel} | ||
position={{ | ||
lat: 25.0391667, | ||
lng: 121.525, | ||
}} | ||
opacity={0} | ||
labelClass="map-price-container" | ||
labelAnchor={new google.maps.Point(35, 27)} | ||
labelContent={`<div class="map-price-marker "><span>$135,123.00</span></div>`} | ||
labelStyle={{opacity: 0.8}} | ||
/> | ||
</GoogleMap> | ||
)); | ||
|
||
export default class MarkerWithLabelExample extends Component { | ||
render() { | ||
return ( | ||
<MarkerWithLabelExampleMap | ||
containerElement={ | ||
<div style={{ height: `100%` }} /> | ||
} | ||
mapElement={ | ||
<div style={{ height: `100%` }} /> | ||
} | ||
/> | ||
) | ||
} | ||
} |
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,7 +1,10 @@ | ||
import MarkerClustererExample from "./MarkerClustererExample"; | ||
import MarkerWithLabelExample from "./MarkerWithLabelExample"; | ||
|
||
MarkerClustererExample.__raw = require(`!raw!./MarkerClustererExample`); | ||
MarkerWithLabelExample.__raw = require(`!raw!./MarkerWithLabelExample`); | ||
|
||
export { | ||
MarkerClustererExample, | ||
MarkerWithLabelExample, | ||
}; |
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,96 @@ | ||
|
||
.map-price-container { | ||
overflow: visible !important; | ||
} | ||
|
||
.map-price-marker { | ||
position: relative; | ||
width: 70px; | ||
height: 21px; | ||
border-radius: 3px; | ||
line-height: 22px; | ||
background-color: #52ca46; | ||
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.07); | ||
text-align: center; | ||
color: #fff; | ||
font-size: 11px; | ||
font-family: MuseoSans; | ||
font-weight: 700; | ||
user-select: none; | ||
border-width: 1px; | ||
border-style: solid; | ||
border-color: #3e9435; | ||
z-index: 1; | ||
} | ||
.map-price-marker:before, | ||
.map-price-marker:after { | ||
position: absolute; | ||
content: ""; | ||
width: 0; | ||
height: 0; | ||
border-style: solid; | ||
display: block; | ||
} | ||
|
||
.map-price-marker:after { | ||
left: 31px; | ||
top: 19px; | ||
border-width: 5px; | ||
border-color: #52ca46 transparent transparent; | ||
} | ||
|
||
.map-price-marker:before { | ||
left: 30px; | ||
top: 20px; | ||
border-width: 6px; | ||
border-color: #3e9435 transparent transparent; | ||
} | ||
|
||
.map-price-marker.visited { | ||
background-color: #fff; | ||
color: #7b8d93; | ||
border-color: #7b8d93; | ||
} | ||
|
||
.map-price-marker.visited:after { | ||
border-color: #fff transparent transparent; | ||
} | ||
|
||
.map-price-marker.visited:before { | ||
border-color: #7b8d93 transparent transparent; | ||
} | ||
|
||
.map-price-marker.visited.active, | ||
.map-price-marker.visited:hover { | ||
background-color: #7b8d93; | ||
color: #fff; | ||
border-color: #5b6a6f; | ||
} | ||
|
||
.map-price-marker.visited.active:after, | ||
.map-price-marker.visited:hover:after { | ||
border-color: #7b8d93 transparent transparent; | ||
} | ||
|
||
.map-price-marker.visited.active:before, | ||
.map-price-marker.visited:hover:before { | ||
border-color: #5b6a6f transparent transparent; | ||
} | ||
|
||
.map-price-marker.active, | ||
.map-price-marker:hover { | ||
background-color: #3e9435; | ||
color: #fff; | ||
border-color: #3e9435; | ||
z-index: 3; | ||
} | ||
|
||
.map-price-marker.active:after, | ||
.map-price-marker:hover:after { | ||
border-color: #3e9435 transparent transparent; | ||
} | ||
|
||
.map-price-marker.active:before, | ||
.map-price-marker:hover:before { | ||
border-color: #3e9435 transparent transparent; | ||
} |
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