layouts: map: Allow specifying width/height in the shortcode tag

This commit is contained in:
Martin Rubli
2023-10-16 20:21:18 +02:00
parent ea709de623
commit 78588d0c2d
2 changed files with 8 additions and 4 deletions

View File

@@ -2,7 +2,7 @@
Syntax summary: Syntax summary:
{{< leaflet-map centerLat=FLOAT centerLon=FLOAT zoom=INT >}} {{< leaflet-map centerLat=FLOAT centerLon=FLOAT zoom=INT width="STRING" height="STRING" >}}
{{< leaflet-layer id="STRING" apiKey="STRING" >}} {{< leaflet-layer id="STRING" apiKey="STRING" >}}
@@ -22,6 +22,12 @@ Map options:
Center point coordinates of the map as decimal values. Optional iif tracks or markers are given. Center point coordinates of the map as decimal values. Optional iif tracks or markers are given.
zoom: zoom:
Zoom level of the map. Optional iif tracks or markers are given. Zoom level of the map. Optional iif tracks or markers are given.
width:
Width of the map, including CSS units (e.g. "50%", "300px").
Optional, defaults to "600px".
height:
Height of the map, including CSS units (e.g. "50%", "300px").
Optional, defaults to "400px".
Layer options: Layer options:
@@ -84,7 +90,7 @@ Elevation profile options:
{{ $uniqueId := .Ordinal | safeJS }} {{ $uniqueId := .Ordinal | safeJS }}
<div id="map_container_{{ $uniqueId }}" class="map-container"> <div id="map_container_{{ $uniqueId }}" class="map-container" style="width: {{ .Get "width" | default "600px" }}; height: {{ .Get "height" | default "400px" }};">
<div id="map_{{ $uniqueId }}" class="map"></div> <div id="map_{{ $uniqueId }}" class="map"></div>
<div id="map_backdrop_{{ $uniqueId }}" class="map-backdrop"></div> <div id="map_backdrop_{{ $uniqueId }}" class="map-backdrop"></div>
<div id="map_attribution_{{ $uniqueId }}" class="map-attribution"></div> <div id="map_attribution_{{ $uniqueId }}" class="map-attribution"></div>

View File

@@ -1,6 +1,4 @@
.map-container { .map-container {
height: 400px;
width: 600px;
padding: 6px 6px 18px 6px; padding: 6px 6px 18px 6px;
background: #eee; background: #eee;
border-radius: 8px; border-radius: 8px;