feat(map): mobile fullscreen button for feed mini-map
Button in the bottom-right corner of the map, hidden ≥769px. Clicking it toggles .is-fullscreen on .feed-map-wrap (position:fixed, full viewport), locks body scroll, and calls feedMap.resize() so MapLibre re-renders at the new size. Icon swaps between expand SVG and ✕. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vgmzx8VTTTmCskSpQtsLTr
This commit is contained in:
@@ -653,6 +653,7 @@ body::after {
|
||||
}
|
||||
|
||||
.feed-map {
|
||||
position: relative;
|
||||
height: 240px;
|
||||
width: 100%;
|
||||
}
|
||||
@@ -661,6 +662,51 @@ body::after {
|
||||
.feed-map { height: 300px; }
|
||||
}
|
||||
|
||||
.feed-map-fullscreen-btn {
|
||||
position: absolute;
|
||||
bottom: var(--space-2);
|
||||
right: var(--space-2);
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
border: none;
|
||||
border-radius: var(--radius-sm);
|
||||
color: var(--color-ink);
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 20;
|
||||
box-shadow: var(--shadow-sm);
|
||||
transition: background 0.15s;
|
||||
}
|
||||
|
||||
.feed-map-fullscreen-btn:hover { background: rgba(255, 255, 255, 1); }
|
||||
|
||||
.feed-map-fs-close { display: none; font-size: 1rem; line-height: 1; }
|
||||
|
||||
@media (min-width: 769px) {
|
||||
.feed-map-fullscreen-btn { display: none; }
|
||||
}
|
||||
|
||||
.feed-map-wrap.is-fullscreen {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 9999;
|
||||
margin: 0;
|
||||
border-radius: 0;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.feed-map-wrap.is-fullscreen .feed-map {
|
||||
height: 100dvh;
|
||||
}
|
||||
|
||||
.feed-map-wrap.is-fullscreen .feed-map-link { display: none; }
|
||||
|
||||
.feed-map-wrap.is-fullscreen .feed-map-fs-open { display: none; }
|
||||
.feed-map-wrap.is-fullscreen .feed-map-fs-close { display: block; }
|
||||
|
||||
.feed-map-link {
|
||||
display: block;
|
||||
text-align: right;
|
||||
|
||||
@@ -37,7 +37,14 @@
|
||||
|
||||
{% if map_entries|length > 0 %}
|
||||
<div class="feed-map-wrap">
|
||||
<div class="feed-map" id="feed-map"></div>
|
||||
<div class="feed-map" id="feed-map">
|
||||
<button class="feed-map-fullscreen-btn" id="feed-map-fullscreen" aria-label="Expand map">
|
||||
<svg class="feed-map-fs-open" aria-hidden="true" width="14" height="14" viewBox="0 0 14 14" fill="currentColor">
|
||||
<path d="M0 0v4h1.5V1.5H4V0z M14 0H10v1.5h2.5V4H14z M0 14v-4h1.5v2.5H4V14z M14 14H10v-1.5h2.5V10H14z"/>
|
||||
</svg>
|
||||
<span class="feed-map-fs-close" aria-hidden="true">✕</span>
|
||||
</button>
|
||||
</div>
|
||||
<a class="feed-map-link" href="{{ page.parent().url }}/map">View full map →</a>
|
||||
</div>
|
||||
|
||||
@@ -86,6 +93,19 @@ feedMap.on('load', function () {
|
||||
MapUtils.addJourneySegments(feedMap, segments, 'feed-journey');
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
(function() {
|
||||
var fsBtn = document.getElementById('feed-map-fullscreen');
|
||||
var mapWrap = document.querySelector('.feed-map-wrap');
|
||||
if (!fsBtn || !mapWrap) return;
|
||||
fsBtn.addEventListener('click', function() {
|
||||
var isFs = mapWrap.classList.toggle('is-fullscreen');
|
||||
fsBtn.setAttribute('aria-label', isFs ? 'Close map' : 'Expand map');
|
||||
document.body.style.overflow = isFs ? 'hidden' : '';
|
||||
setTimeout(function() { typeof feedMap !== 'undefined' && feedMap.resize(); }, 50);
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
<div class="feed-sort-bar">
|
||||
|
||||
Reference in New Issue
Block a user