File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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+ embedCode? : string ;
5+ mapId? : string ;
6+ lat? : number ;
7+ lng? : number ;
8+ zoom? : number ;
9+ mapType? : " roadmap" | " satellite" | " hybrid" | " terrain" ;
10+ title? : string ;
11+ width? : string ;
12+ maxWidth? : string ;
13+ aspectRatio? : string ;
14+ borderWidth? : string ;
15+ borderColor? : string ;
16+ rounded? : string ;
17+ shadow? : string ;
18+ loading? : " eager" | " lazy" ;
19+ referrerPolicy? : string ;
20+ }
21+
22+ const {
23+ location,
24+ embedCode,
25+ mapId,
26+ lat,
27+ lng,
28+ zoom = 14 ,
29+ mapType = " roadmap" ,
30+ title = " Map" ,
31+ loading = " lazy" ,
32+ referrerPolicy = " no-referrer-when-downgrade" ,
33+ } = Astro .props ;
34+
35+
36+ let src = " " ;
37+
38+ if (embedCode ) {
39+ const srcMatch = embedCode .match (/ src="([^ "] + )"/ );
40+ src = srcMatch ? srcMatch [1 ] : " " ;
41+ }
42+ else if (lat && lng ) {
43+ src = ` https://maps.google.com/maps?q=${lat },${lng }&z=${zoom }&t=${
44+ mapType === " satellite" ? " k" :
45+ mapType === " hybrid" ? " h" :
46+ mapType === " terrain" ? " p" : " m"
47+ }&output=embed ` ;
48+ }
49+
50+ else if (mapId ) {
51+ src = ` https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3000!2d-73.9857!3d40.7484!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s${mapId }!2s!5e0!3m2!1sen!2sus!4v1684164357244!5m2!1sen!2sus ` ;
52+ }
53+ else if (location ) {
54+ src = ` https://maps.google.com/maps?q=${encodeURIComponent (location )}&t=${
55+ mapType === " satellite" ? " k" :
56+ mapType === " hybrid" ? " h" :
57+ mapType === " terrain" ? " p" : " m"
58+ }&z=${zoom }&output=embed&iwloc=near ` ;
59+ }
60+ ---
61+
62+ <div class =" astro-map-container w-full aspect-video max-w-[800px] border-4 border-white rounded-lg shadow-lg" >
63+ { src && (
64+ <iframe
65+ src = { src }
66+ title = { title }
67+ class = " w-full aspect-video "
68+ allowFullScreen = { true }
69+ loading = { loading }
70+ referrerPolicy = { referrerPolicy }
71+ style = " border:0;"
72+ ></iframe >
73+ )}
74+ </div >
75+
76+ <style >
77+ .astro-map-container {
78+ width: 100%;
79+ }
80+ </style >
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