themes-magazine-bold/blocks/lookbook.ninjatpl
2026-07-05 17:53:45 +08:00

43 lines
2.7 KiB
Plaintext

{# lookbook (magazine-bold) — grid of duotone look frames with mono numbering, captions and optional shop links. Fields: heading, intro, looks[].image/.caption/.credit/.link/.linkLabel. Image via {% img %} (media filter not registered in block render path). MID motion: duotone hover + mb-reveal, reduced-motion safe. #}
<section data-block="magazine-bold:lookbook" class="w-full overflow-hidden py-10 md:py-12">
<div class="mx-auto max-w-6xl px-4 sm:px-6">
{% if heading %}<h2 class="mb-heading text-3xl md:text-5xl text-foreground">{{ heading }}</h2>{% endif %}
{% if intro %}<p class="mt-4 max-w-2xl text-deck text-muted-foreground">{{ intro }}</p>{% endif %}
{% if looks %}
<div class="mt-10 grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
{% for look in looks %}
<figure class="mb-reveal flex flex-col">
{% if look.image %}<div class="mb-duotone aspect-[3/4] w-full overflow-hidden">{% img look.image alt=look.caption|default:"" class="h-full w-full object-cover" %}</div>{% endif %}
<figcaption class="mt-3 flex items-baseline gap-3">
<span class="mb-caps text-[hsl(var(--accent))]">{{ forloop.Counter|stringformat:"%02d" }}</span>
<span class="min-w-0">
{% if look.caption %}<span class="block text-sm font-medium text-foreground">{{ look.caption }}</span>{% endif %}
{% if look.credit %}<span class="mb-caps block text-muted-foreground">{{ look.credit }}</span>{% endif %}
</span>
</figcaption>
{% if look.link %}<a href="{{ look.link }}" class="mb-link mt-2 inline-block text-sm">{{ look.linkLabel|default:"Shop the look" }}</a>{% endif %}
</figure>
{% endfor %}
</div>
{% else %}<div class="mb-caption py-12">No looks yet.</div>{% endif %}
</div>
</section>
<script>
(function(){
if(window.__mbReveal)return;window.__mbReveal=1;
function run(){
var reduce=window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches;
var els=document.querySelectorAll('.mb-reveal');
if(!els.length)return;
if(reduce||!('IntersectionObserver' in window)){els.forEach(function(el){el.classList.add('mb-in');});return;}
els.forEach(function(el){el.classList.add('mb-armed');});
var io=new IntersectionObserver(function(entries){entries.forEach(function(e){if(e.isIntersecting){e.target.classList.add('mb-in');io.unobserve(e.target);}});},{threshold:0.12,rootMargin:'0px 0px -8% 0px'});
els.forEach(function(el){io.observe(el);});
var revealAll=function(){els.forEach(function(el){el.classList.add('mb-in');});};
setTimeout(revealAll,900);
window.addEventListener('load',revealAll,{once:true});
}
if(document.readyState!='loading')run();else document.addEventListener('DOMContentLoaded',run);
})();
</script>