styled for norm layouts and added logic for optional maps info

This commit is contained in:
worktop 2024-02-05 16:11:28 -05:00
parent b50c0b64ed
commit 4e7f19f5b3
2 changed files with 56 additions and 119 deletions

View File

@ -9,6 +9,7 @@
<div class="map" >
{{ $apiKey := .Site.Params.apiKey }}
{{ $label := .Get "label" }}
{{ $url := .Get "url" }}
{{ $adr := .Get "address" }}
{{ $adrURL := urlquery $adr }}
{{ $LLapiURL := printf "https://api.geoapify.com/v1/geocode/search?text=%s&format=json&apiKey=%s" $adrURL $apiKey }}
@ -19,14 +20,20 @@
{{ $lat := .lat }}
{{ $MapApiUrl := printf "https://maps.geoapify.com/v1/staticmap?style=osm-bright&width=500&height=500&center=lonlat:%f,%f&zoom=12&marker=lonlat:%f,%f;color:%%23ff0000;size:medium&scaleFactor=2&apiKey=%s" $lon $lat $lon $lat $apiKey }}
<img src="{{ $MapApiUrl }}" width=350px />
<img src="{{ $MapApiUrl }}" width=350px />
<div class="map-txt-grid">
<div class="grid-item"><p><b>{{ $label }}</b></p></div>
<div class="grid-item">
{{ with $label }}
<p><b>{{ $label }}</b></p>
{{ end }}
</div>
<div class="grid-item"><p>{{ .address_line1 }}<br/>{{ replaceRE `, United States of America$` "" .address_line2 }}</p></div>
{{end}}
<div class="grid-item">
<div class="child-element">
<a class="map-button" href="{{ .Get "url" }}" target="_blank">See on Google Maps</a>
{{ with $url }}
<a class="map-button" href="{{ $url }}" target="_blank">See on Google Maps</a>
{{ end }}
</div>
</div>
</div>

View File

@ -1,8 +1,4 @@
.map-txt-grid {
display: grid;
grid-template-rows: auto auto; /* Two rows, first row adjusts to content, second row adjusts to content */
grid-template-columns: 1fr 1fr; /* Two columns for the entire grid */
}
.grid-item {
margin: 0;
@ -14,12 +10,17 @@
}
/* Adjust the first row to span two columns */
.grid-item:first-child {
grid-column: span 2; /* Span two columns */
}
.location {
background-color: var(--alt-bg);
border-left-color: var(--acc-1);
border-left-width: 5px;
border-left-style: solid;
padding: 15px 15px 15px 10px;
}
/* .location { */
/* */
/* */
@ -35,9 +36,30 @@
border-radius: 8px;
}
/* */
/* */
.map {
display: flex;
}
.map-txt-grid {
display: grid;
grid-template-rows: auto 1fr auto;
grid-template-columns: 1fr;
grid-gap: 10px;
position: relative;
left: 15px;
}
.map img {
display: block;
}
@media screen and (max-width: 755px) {
.map {
display: block;
}
.map-button {
position: absolute;
bottom: 0;
@ -56,12 +78,7 @@
margin-left: auto;
margin-right: auto;
/* display: block; */
background-color: var(--alt-bg);
border-left-color: var(--acc-1);
border-left-width: 5px;
border-left-style: solid;
padding: 15px 15px 15px 10px;
/* padding: 20px; */
/* margin: 0; */
}
@ -71,104 +88,17 @@
}
.map-txt-grid {
margin-top: 10px;
display: grid;
grid-template-rows: auto auto; /* Two rows, first row adjusts to content, second row adjusts to content */
grid-template-columns: 1fr 1fr; /* Two columns for the entire grid */
}
.map-txt-grid {
margin-top: 10px;
left: 0;
}
.grid-item:first-child {
grid-column: span 2; /* Span two columns */
}
}
/* .map span.map-txt { margin-top: 5px; } */
/* */
/* p.label, p.adress { margin: 0; } */
/* */
/* p.adress { width: 50%;} */
/* */
/* /* span.map-txt a.map-button { */ */
/* /* float: right; */ */
/* /* bottom: 0; */ */
/* /* right: 0; */ */
/* /* } */ */
/* } */
/* .map { */
/* max-width: 100%; */
/* width: 50rem; */
/* height: 50rem; */
/* background: url(/img/marker.svg) center calc(50% - 1rem) / auto 2rem no-repeat, url(/img/map.jpg) center center / cover no-repeat; */
/* position: relative; */
/* display: block; */
/* } */
/* .map > div { */
/* position: absolute; */
/* top: 50%; */
/* width: 100%; */
/* text-align: center; */
/* color: #b31412; */
/* font-weight: 400; */
/* line-height: 1.2; */
/* } */
/* */
/* .map > div.button.large span { */
/* color: #1a73e8; */
/* font-size: 0.65rem; */
/* } */
/* */
/* .map > div.button.large { */
/* color: black; */
/* text-align: left; */
/* padding: 0.4rem 0.6rem; */
/* height: auto; */
/* top: 0.5rem; */
/* bottom: auto; */
/* width: 13rem; */
/* left: 0.5rem; */
/* right: auto; */
/* background: white; */
/* } */
/* */
/* .map a { */
/* color: white; */
/* text-decoration: none; */
/* } */
/* */
/* .map body { */
/* font-family: 'Roboto', sans-serif; */
/* line-height: 1.6; */
/* color: #333; */
/* background: white; */
/* font-weight: 300; */
/* } */
/* */
/* .map > div.button { */
/* top: auto; */
/* bottom: 1.5rem; */
/* width: 2rem; */
/* height: 2rem; */
/* right: 0.5rem; */
/* background: white url(/img/open_in_new_FILL0_wght400_GRAD0_opsz48.svg) center center / 88% auto no-repeat; */
/* box-shadow: 0px 0px 0.25rem rgb(0 0 0 / 20%); */
/* } */
/* */
/* .map > div.footer { */
/* background: rgba(255,255,255,0.75); */
/* line-height: 1.85; */
/* color: #333; */
/* font-weight: 400; */
/* top: auto; */
/* bottom: 0; */
/* left: 0; */
/* font-size: 0.55rem; */
/* padding: 0 0.25rem; */
/* text-align: left; */
/* } */