diff --git a/src/components/Map.astro b/src/components/Map.astro index ebe0b858c..4a71f03cd 100644 --- a/src/components/Map.astro +++ b/src/components/Map.astro @@ -1,10 +1,38 @@ - - - +--- +interface Props { + location?: string; + lat?: number; + lng?: number; + zoom?: number; + title?: string; +} + +const { + location, + lat, + lng, + zoom = 14, + title = "Map", +} = Astro.props; + +let src = ""; +if (lat && lng) { + src = `https://maps.google.com/maps?q=${lat},${lng}&z=${zoom}&t=m&output=embed`; +} +else if (location) { + src = `https://maps.google.com/maps?q=${encodeURIComponent(location)}&t=m&z=${zoom}&output=embed&iwloc=near`; +} +--- +
+ {src && ( + + )} +
diff --git a/src/content/pages/test.mdx b/src/content/pages/test.mdx index 90bc1f5f8..6a60bfc69 100644 --- a/src/content/pages/test.mdx +++ b/src/content/pages/test.mdx @@ -281,3 +281,48 @@ Barking up the right tree ***Hau hau!*** + +## Maps +

Example 1: Map with Location

+ + +

Example 2: Map with Coordinates (Latitude & Longitude)

+ + +

Example 3: Map with Default Zoom Level

+ + +

Example 4: Map with Custom Title

+ + +

Example 5: Map with All Default Values

+ + +

Usage in Layout

+
+
+

New York

+ +
+
+

London

+ +
+
diff --git a/src/content/pages/venue.mdx b/src/content/pages/venue.mdx index f0d2e8efd..67df616e9 100644 --- a/src/content/pages/venue.mdx +++ b/src/content/pages/venue.mdx @@ -23,7 +23,7 @@ Vyšehrad station (on Line C of the Prague underground railway) is right next to the venue and offers convenient public transport from the airport and all major rail and bus stations. - +
**Entrance 5**