feat(photos): blurred ambient fill, dots overlay, PhotoSwipe on trip + dailies

- object-fit: contain + ::before blurred background fill on all slides
- dots moved inside photo-wrap, overlaid at bottom with shadow for contrast
- arrows hidden on touch devices via @media (hover: none)
- margin-bottom increased for breathing room below photo block
- trip.html.twig brought up to parity with dailies: same structure,
  same PhotoSwipe init, same expand button, same dot overlay

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vgmzx8VTTTmCskSpQtsLTr
This commit is contained in:
2026-06-21 20:09:24 +02:00
parent 3379e50503
commit 5c75f1416f
3 changed files with 96 additions and 25 deletions
+30 -6
View File
@@ -204,7 +204,7 @@ body::after {
.journal-photo-wrap { .journal-photo-wrap {
position: relative; position: relative;
margin-bottom: var(--space-3); margin-bottom: var(--space-5);
border-radius: var(--radius-md); border-radius: var(--radius-md);
overflow: hidden; overflow: hidden;
} }
@@ -225,12 +225,27 @@ body::after {
overflow: hidden; overflow: hidden;
display: block; display: block;
text-decoration: none; text-decoration: none;
position: relative;
}
.journal-photo-slide::before {
content: '';
position: absolute;
inset: 0;
background-image: var(--thumb);
background-size: cover;
background-position: center;
filter: blur(24px) brightness(0.75);
transform: scale(1.15);
z-index: 0;
} }
.journal-photo-slide img { .journal-photo-slide img {
position: relative;
z-index: 1;
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: contain;
display: block; display: block;
} }
@@ -251,27 +266,32 @@ body::after {
padding: 0; padding: 0;
z-index: 2; z-index: 2;
-webkit-tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent;
transform: translateZ(0);
} }
.journal-photo-expand:active { background: rgba(0,0,0,0.7); } .journal-photo-expand:active { background: rgba(0,0,0,0.7); }
.journal-photo-dots { .journal-photo-dots {
position: absolute;
bottom: var(--space-3);
left: 50%;
transform: translateX(-50%);
display: flex; display: flex;
justify-content: center;
gap: var(--space-2); gap: var(--space-2);
margin-bottom: var(--space-4); z-index: 2;
} }
.journal-photo-dot { .journal-photo-dot {
width: 6px; width: 6px;
height: 6px; height: 6px;
border-radius: 9999px; border-radius: 9999px;
background: var(--color-border); background: rgba(255,255,255,0.5);
box-shadow: 0 0 0 1px rgba(0,0,0,0.2), 0 1px 3px rgba(0,0,0,0.4);
transition: background 0.2s; transition: background 0.2s;
} }
.journal-photo-dot.is-active { .journal-photo-dot.is-active {
background: var(--color-ink-muted); background: #fff;
} }
.strip-controls { .strip-controls {
@@ -282,6 +302,10 @@ body::after {
margin-bottom: var(--space-4); margin-bottom: var(--space-4);
} }
@media (hover: none) {
.strip-controls { display: none; }
}
.strip-prev, .strip-prev,
.strip-next { .strip-next {
background: transparent; background: transparent;
@@ -129,22 +129,23 @@ feedMap.on('load', function () {
href="{{ img.url }}" href="{{ img.url }}"
data-pswp-width="{{ img.width }}" data-pswp-width="{{ img.width }}"
data-pswp-height="{{ img.height }}" data-pswp-height="{{ img.height }}"
style="--thumb: url('{{ img.cropResize(900, 675).url }}')"
target="_blank"> target="_blank">
<img src="{{ img.cropResize(900, 675).url }}" alt="{{ entry.title }}" loading="lazy"> <img src="{{ img.cropResize(900, 675).url }}" alt="{{ entry.title }}" loading="lazy">
</a> </a>
{% endfor %} {% endfor %}
</div> </div>
{% if images|length > 1 %}
<div class="journal-photo-dots" aria-hidden="true">
{% for img in images %}
<span class="journal-photo-dot{% if loop.first %} is-active{% endif %}"></span>
{% endfor %}
</div>
{% endif %}
<button class="journal-photo-expand" aria-label="View full size"> <button class="journal-photo-expand" aria-label="View full size">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/></svg> <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/></svg>
</button> </button>
</div> </div>
{% if images|length > 1 %}
<div class="journal-photo-dots" aria-hidden="true">
{% for img in images %}
<span class="journal-photo-dot{% if loop.first %} is-active{% endif %}"></span>
{% endfor %}
</div>
{% endif %}
{% endif %} {% endif %}
<div class="journal-post-body">{{ entry.content|raw }}</div> <div class="journal-post-body">{{ entry.content|raw }}</div>
+58 -12
View File
@@ -1,6 +1,7 @@
{% extends 'partials/base.html.twig' %} {% extends 'partials/base.html.twig' %}
{% block content %} {% block content %}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@5/dist/photoswipe.css">
{% set dailies_page = grav.pages.find(page.route ~ '/dailies') %} {% set dailies_page = grav.pages.find(page.route ~ '/dailies') %}
{% set stories_page = grav.pages.find(page.route ~ '/stories') %} {% set stories_page = grav.pages.find(page.route ~ '/stories') %}
{% set journal_entries = dailies_page ? dailies_page.children.published() : [] %} {% set journal_entries = dailies_page ? dailies_page.children.published() : [] %}
@@ -246,20 +247,30 @@
{% set images = entry.media.images %} {% set images = entry.media.images %}
{% if images|length > 0 %} {% if images|length > 0 %}
<div class="journal-photo-strip" data-slides="{{ images|length }}"> <div class="journal-photo-wrap">
{% for img in images %} <div class="journal-photo-strip pswp-gallery" id="gallery-{{ entry.slug }}">
<div class="journal-photo-slide"> {% for img in images %}
<img src="{{ img.cropResize(900, 600).url }}" alt="{{ entry.title }}" loading="lazy"> <a class="journal-photo-slide"
href="{{ img.url }}"
data-pswp-width="{{ img.width }}"
data-pswp-height="{{ img.height }}"
style="--thumb: url('{{ img.cropResize(900, 675).url }}')"
target="_blank">
<img src="{{ img.cropResize(900, 675).url }}" alt="{{ entry.title }}" loading="lazy">
</a>
{% endfor %}
</div> </div>
{% endfor %} {% if images|length > 1 %}
<div class="journal-photo-dots" aria-hidden="true">
{% for img in images %}
<span class="journal-photo-dot{% if loop.first %} is-active{% endif %}"></span>
{% endfor %}
</div>
{% endif %}
<button class="journal-photo-expand" aria-label="View full size">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/></svg>
</button>
</div> </div>
{% if images|length > 1 %}
<div class="journal-photo-dots" aria-hidden="true">
{% for img in images %}
<span class="journal-photo-dot{% if loop.first %} is-active{% endif %}"></span>
{% endfor %}
</div>
{% endif %}
{% endif %} {% endif %}
<div class="journal-post-body">{{ entry.content|raw }}</div> <div class="journal-post-body">{{ entry.content|raw }}</div>
@@ -547,4 +558,39 @@ function parseGpxFiles(urls, callback) {
} }
})(); })();
</script> </script>
<script type="module">
import PhotoSwipeLightbox from 'https://cdn.jsdelivr.net/npm/photoswipe@5/dist/photoswipe-lightbox.esm.min.js';
const lightbox = new PhotoSwipeLightbox({
gallery: '.pswp-gallery',
children: 'a.journal-photo-slide',
pswpModule: () => import('https://cdn.jsdelivr.net/npm/photoswipe@5/dist/photoswipe.esm.min.js')
});
lightbox.init();
document.querySelectorAll('.journal-photo-wrap').forEach(function (wrap) {
var strip = wrap.querySelector('.journal-photo-strip');
var slides = Array.from(strip.querySelectorAll('a.journal-photo-slide'));
var expandBtn = wrap.querySelector('.journal-photo-expand');
var article = wrap.closest('article');
var dots = article ? Array.from(article.querySelectorAll('.journal-photo-dot')) : [];
var visibleIdx = 0;
var io = new IntersectionObserver(function (entries) {
entries.forEach(function (e) {
if (!e.isIntersecting) return;
visibleIdx = slides.indexOf(e.target);
dots.forEach(function (d) { d.classList.remove('is-active'); });
if (dots[visibleIdx]) dots[visibleIdx].classList.add('is-active');
});
}, { root: strip, threshold: 0.5 });
slides.forEach(function (s) { io.observe(s); });
if (expandBtn && slides.length) {
expandBtn.addEventListener('click', function () {
slides[visibleIdx].dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true }));
});
}
});
</script>
{% endblock %} {% endblock %}