Skip to content

Commit 8c2b20d

Browse files
committed
Map update.
1 parent 1d71631 commit 8c2b20d

File tree

2 files changed

+92
-17
lines changed

2 files changed

+92
-17
lines changed

src/components/Map.astro

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
import type { HTMLAttributeReferrerPolicy } from 'react';
3+
24
interface Props {
35
location?: string;
46
embedCode?: string;
@@ -8,15 +10,8 @@ interface Props {
810
zoom?: number;
911
mapType?: "roadmap" | "satellite" | "hybrid" | "terrain";
1012
title?: string;
11-
width?: string;
12-
maxWidth?: string;
13-
aspectRatio?: string;
14-
borderWidth?: string;
15-
borderColor?: string;
16-
rounded?: string;
17-
shadow?: string;
1813
loading?: "eager" | "lazy";
19-
referrerPolicy?: string;
14+
referrerPolicy?: HTMLAttributeReferrerPolicy;
2015
}
2116
2217
const {
@@ -64,17 +59,11 @@ else if (location) {
6459
<iframe
6560
src={src}
6661
title={title}
67-
class="w-full aspect-video "
68-
allowFullScreen={true}
62+
class="w-full aspect-video"
63+
allowfullscreen={true}
6964
loading={loading}
70-
referrerPolicy={referrerPolicy}
65+
referrerpolicy={referrerPolicy}
7166
style="border:0;"
7267
></iframe>
7368
)}
7469
</div>
75-
76-
<style>
77-
.astro-map-container {
78-
width: 100%;
79-
}
80-
</style>

src/content/pages/test.mdx

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,89 @@ Barking up the right tree
281281
<Accordion title="Finnish-speaking dogs" id="finnish">
282282
***Hau hau!***
283283
</Accordion>
284+
285+
## Maps
286+
287+
<h2>Example 1: Map with Location</h2>
288+
<Map
289+
location="Empire State Building, New York"
290+
zoom={15}
291+
/>
292+
293+
<h2>Example 2: Map with Location and Custom Map Type</h2>
294+
<Map
295+
location="Grand Canyon, Arizona"
296+
mapType="satellite"
297+
zoom={12}
298+
/>
299+
300+
<h2>Example 3: Map with Coordinates (Latitude & Longitude)</h2>
301+
<Map
302+
lat={48.8584}
303+
lng={2.2945}
304+
zoom={16}
305+
title="Eiffel Tower, Paris"
306+
/>
307+
308+
<h2>Example 4: Map with Coordinates and Terrain Map Type</h2>
309+
<Map
310+
lat={36.1069}
311+
lng={-112.1129}
312+
mapType="terrain"
313+
zoom={13}
314+
title="Grand Canyon"
315+
/>
316+
317+
<h2>Example 5: Map with Hybrid Map Type</h2>
318+
<Map
319+
location="Sydney Opera House"
320+
mapType="hybrid"
321+
zoom={17}
322+
/>
323+
324+
<h2>Example 6: Map with Map ID</h2>
325+
<Map
326+
mapId="0x89c259a944867e5b:0xb2c96748fa5e9cf"
327+
title="Central Park, New York"
328+
/>
329+
330+
<h2>Example 7: Map with Embed Code from Google Maps</h2>
331+
<Map
332+
embedCode='<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2624.9916256937586!2d2.2922926156740954!3d48.858370079287475!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x47e66e2964e34e2d%3A0x8ddca9ee380ef7e0!2sEiffel%20Tower!5e0!3m2!1sen!2sus!4v1621536319249!5m2!1sen!2sus" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy"></iframe>'
333+
title="Eiffel Tower Embed"
334+
/>
335+
336+
<h2>Example 8: Map with Loading Performance Options</h2>
337+
<Map
338+
location="Golden Gate Bridge, San Francisco"
339+
loading="eager"
340+
referrerPolicy="strict-origin"
341+
/>
342+
343+
<h2>Example 9: Map with All Default Values</h2>
344+
<Map
345+
location="Statue of Liberty, New York"
346+
/>
347+
348+
<h2>Example 10: Full Custom Configuration</h2>
349+
<Map
350+
lat={40.7484}
351+
lng={-73.9857}
352+
zoom={16}
353+
mapType="hybrid"
354+
title="Empire State Building"
355+
loading="eager"
356+
referrerPolicy="no-referrer"
357+
/>
358+
359+
<h2>Usage in Layout</h2>
360+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
361+
<div>
362+
<h3>New York</h3>
363+
<Map location="New York, NY" />
364+
</div>
365+
<div>
366+
<h3>London</h3>
367+
<Map location="London, UK" />
368+
</div>
369+
</div>

0 commit comments

Comments
 (0)