Skip to content

Commit

Permalink
Merge pull request #8 from kashaudhan/staging
Browse files Browse the repository at this point in the history
Removed google.maps.marker, using AdvancedMarker intead.
  • Loading branch information
kashaudhan authored Apr 29, 2024
2 parents 599d8e8 + fb9114d commit 52068ee
Show file tree
Hide file tree
Showing 409 changed files with 7,192 additions and 40,153 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
node_modules
.cache
dist
.parcel-cache/
.parcel-cache/

*.env
49 changes: 14 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# react-gmap-picker

React google maps location picker/marker (latitude, longitude)
React google maps location picker/marker with `Advanced Marker`


## Table of Contents
Expand Down Expand Up @@ -33,6 +33,8 @@ import React from 'react';
const INITIAL_LOCATION = { lat: 13.4, lng: 77.0 };
const INITIAL_ZOOM = 10;

const API_KEY = process.env.API_KEY as string;

const App = () => {
const [defaultLocation, setDefaultLocation] = useState(INITIAL_LOCATION);
const [location, setLocation] = useState(defaultLocation);
Expand Down Expand Up @@ -62,34 +64,17 @@ const App = () => {
<label>Zoom:</label>
<input type="text" value={zoom} disabled />

<div className="row">
<div className="column">
<h4>Map 1 (roadmap)</h4>
<Picker
defaultLocation={defaultLocation}
zoom={zoom}
mapTypeId="roadmap"
style={{ height: '700px' }}
onChangeLocation={handleChangeLocation}
onChangeZoom={handleChangeZoom}
apiKey="AIzaSyD07E1VvpsN_0FvsmKAj4nK9GnLq-9jtj8"
/>
</div>
{/* With custom icon & always fixed marker in center */}
<div className="column">
<h4>Map 2 (satellite)</h4>
<Picker
defaultLocation={defaultLocation}
zoom={zoom}
mapTypeId="satellite"
style={{ height: '700px' }}
onChangeLocation={handleChangeLocation}
onChangeZoom={handleChangeZoom}
alwaysCentered={true}
icon={'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png'}
apiKey="AIzaSyD07E1VvpsN_0FvsmKAj4nK9GnLq-9jtj8"
/>
</div>
<div>
<h4>Map 1 (roadmap)</h4>
<Picker
defaultLocation={defaultLocation}
zoom={zoom}
mapTypeId="roadmap"
style={{ height: '700px' }}
onChangeLocation={handleChangeLocation}
onChangeZoom={handleChangeZoom}
apiKey={API_KEY}
/>
</div>
</div>
);
Expand All @@ -111,10 +96,4 @@ export default App;
| `style` | `any` | { width: '100%', height: '600px' } | Map container style. |
| `className` | `string` | undefined | Map className. |
| `mapTypeId` | [google.maps.MapTypeId](https://developers.google.com/maps/documentation/javascript/maptypes) | undefined | Map type you want to see. |
| `icon` | `string \| null \| undefined ` \| [google.maps.Icon](https://developers.google.com/maps/documentation/javascript/examples/icon-simple) \| [google.maps.Symbols](https://developers.google.com/maps/documentation/javascript/symbols) | undefined | Marker icon. |
| `alwaysCentered` | `boolean` | false | Fix marker in center if `true`. |


A special thanks to @phamtung1 for inspiration:

[![](https://avatars.githubusercontent.com/u/11594890?v=4&size=20)](https://github.com/phamtung1)
83 changes: 0 additions & 83 deletions example/.parcel-cache/00/23581e760f9537e24b3f6a68493b0f.blob

This file was deleted.

8 changes: 0 additions & 8 deletions example/.parcel-cache/00/6451458dfef9ca1934348d42b3506b.blob

This file was deleted.

7 changes: 0 additions & 7 deletions example/.parcel-cache/00/82bc111bf7209dc0fd17bbb761fc32.blob

This file was deleted.

4 changes: 0 additions & 4 deletions example/.parcel-cache/00/c88bd113880dbf21ff6be49e11b420.blob

This file was deleted.

Loading

0 comments on commit 52068ee

Please sign in to comment.