File tree Expand file tree Collapse file tree 3 files changed +84
-11
lines changed Expand file tree Collapse file tree 3 files changed +84
-11
lines changed Original file line number Diff line number Diff line change 1- <Fragment is:raw >
2- <iframe
3- src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d10245.064741908278!2d14.4290206!3d50.0625764!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x4d26855708eb61f7!2sPrague%20Congress%20Centre!5e0!3m2!1sen!2suk!4v1676555813425!5m2!1sen!2suk"
4- title="Map"
5- class="w-full aspect-video max-w-[800px] border-4 border-white rounded-lg shadow-lg"
6- allowFullScreen="true"
7- loading="lazy"
8- referrerPolicy="no-referrer-when-downgrade"
9- ></iframe>
10- </Fragment >
1+ ---
2+ interface Props {
3+ location? : string ;
4+ lat? : number ;
5+ lng? : number ;
6+ zoom? : number ;
7+ title? : string ;
8+ }
9+
10+ const {
11+ location,
12+ lat,
13+ lng,
14+ zoom = 14 ,
15+ title = " Map" ,
16+ } = Astro .props ;
17+
18+ let src = " " ;
19+ if (lat && lng ) {
20+ src = ` https://maps.google.com/maps?q=${lat },${lng }&z=${zoom }&t=m&output=embed ` ;
21+ }
22+ else if (location ) {
23+ src = ` https://maps.google.com/maps?q=${encodeURIComponent (location )}&t=m&z=${zoom }&output=embed&iwloc=near ` ;
24+ }
25+ ---
26+ <div class =" map-container w-full aspect-video max-w-[800px] border-4 border-white rounded-lg shadow-lg" >
27+ { src && (
28+ <iframe
29+ src = { src }
30+ title = { title }
31+ class = " w-full aspect-video"
32+ allowfullscreen = { true }
33+ loading = " lazy"
34+ referrerpolicy = " no-referrer-when-downgrade"
35+ style = " border:0;"
36+ ></iframe >
37+ )}
38+ </div >
Original file line number Diff line number Diff line change @@ -281,3 +281,48 @@ Barking up the right tree
281281<Accordion title = " Finnish-speaking dogs" id = " finnish" >
282282 *** Hau hau!***
283283</Accordion >
284+
285+ ## Maps
286+ <h2 >Example 1: Map with Location</h2 >
287+ <Map
288+ location = " Empire State Building, New York"
289+ zoom = { 15 }
290+ />
291+
292+ <h2 >Example 2: Map with Coordinates (Latitude & Longitude)</h2 >
293+ <Map
294+ lat = { 48.8584 }
295+ lng = { 2.2945 }
296+ zoom = { 16 }
297+ title = " Eiffel Tower, Paris"
298+ />
299+
300+ <h2 >Example 3: Map with Default Zoom Level</h2 >
301+ <Map
302+ location = " Sydney Opera House"
303+ />
304+
305+ <h2 >Example 4: Map with Custom Title</h2 >
306+ <Map
307+ lat = { 36.1069 }
308+ lng = { - 112.1129 }
309+ zoom = { 13 }
310+ title = " Grand Canyon"
311+ />
312+
313+ <h2 >Example 5: Map with All Default Values</h2 >
314+ <Map
315+ location = " Statue of Liberty, New York"
316+ />
317+
318+ <h2 >Usage in Layout</h2 >
319+ <div class = " grid grid-cols-1 md:grid-cols-2 gap-6" >
320+ <div >
321+ <h3 >New York</h3 >
322+ <Map location = " New York, NY" />
323+ </div >
324+ <div >
325+ <h3 >London</h3 >
326+ <Map location = " London, UK" />
327+ </div >
328+ </div >
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ Vyšehrad station (on Line C of the Prague underground railway) is right next to
2323the venue and offers convenient public transport from the airport and all major
2424rail and bus stations.
2525
26- <Map />
26+ <Map location = " Prague Congress Centre " zoom = { 15 } />
2727
2828<address >
2929** Entrance 5**
You can’t perform that action at this time.
0 commit comments