Third remediation pass, superseding the hand-rolled-CSS approach of 0b3013c now that the host Tailwind build scans theme .ninjatpl files. Hero blank-on-bare-string fix: - The four styled-text fields read field.text|default:field, which HARD-ERRORS when the seed passes a bare string (no .text attribute) and blanks the whole hero. Switch to field|get:"text"|default:field so the process-global get filter degrades gracefully on strings. Layout back to Tailwind (Alex rule: don't reimplement standard utilities): - Revert the .noir-cols*/.noir-cols-2up*/.noir-split/.noir-gap-*/.noir-hero-pad class swaps in 15 override templates back to plain grid/gap/padding utilities (grid-cols-*, gap-*, sm:/md:/lg: variants, py-*), and delete the matching hand-rolled media-query block from manifest css.input_css_append. - Hero split now uses grid grid-cols-1 lg:grid-cols-2 with a Tailwind min-h-80 media frame (guarded so empty seed media does not balloon); the centered hero uses py-16 md:py-20 lg:py-24 instead of min-h-[75vh], keeping the dead-vertical-band trim. Kept from the prior pass: robust .noir-reveal (instant reveal when already in view + load/1600ms safety nets + no-JS/reduced-motion visible), tightened section padding, and the genuinely bespoke safety CSS (empty-media img guards, overflow-wrap, block max-width) — none of which are Tailwind-utility duplicates. No version bump. make + check-safety both exit 0. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
50 lines
2.7 KiB
Plaintext
50 lines
2.7 KiB
Plaintext
{# noir override — stats; preserves heading, intro, columns, countUp, items[].prefix/.value/.suffix/.label, data-stats/data-countup-value + count-up <script> verbatim. #}
|
|
<section data-block-override="noir:stats" class="py-16 md:py-24 bg-background text-foreground{% if class %} {{ class }}{% endif %}"{% if countUp %} data-stats{% endif %}>
|
|
<div class="mx-auto max-w-6xl px-4">
|
|
{% if heading %}<h2 class="noir-heading text-center text-3xl md:text-4xl" style="color:hsl(var(--foreground));">{{ heading }}</h2>{% endif %}
|
|
{% if intro %}<p class="noir-body mx-auto mt-4 max-w-2xl text-center text-lg" style="color:hsl(var(--muted-foreground));">{{ intro }}</p>{% endif %}
|
|
<dl class="mt-10 grid grid-cols-2 gap-8 divide-x divide-border {% if columns == 2 %}md:grid-cols-2{% elif columns == 3 %}md:grid-cols-3{% else %}md:grid-cols-4{% endif %}">
|
|
{% for item in items %}
|
|
<div class="px-2 text-center">
|
|
<dd class="noir-mono text-4xl font-bold tracking-tight md:text-5xl" style="color:hsl(var(--primary));">{% if item.prefix %}{{ item.prefix }}{% endif %}<span{% if countUp %} data-countup-value="{{ item.value }}"{% endif %}>{{ item.value }}</span>{% if item.suffix %}{{ item.suffix }}{% endif %}</dd>
|
|
{% if item.label %}<dt class="noir-label mt-2" style="color:hsl(var(--muted-foreground));">{{ item.label }}</dt>{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
</dl>
|
|
</div>
|
|
</section>
|
|
{% if countUp %}<script>
|
|
(function(){
|
|
var sections = document.querySelectorAll('[data-stats]');
|
|
var reduce = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
function animate(section){
|
|
var nodes = section.querySelectorAll('[data-countup-value]');
|
|
nodes.forEach(function(node){
|
|
var raw = node.getAttribute('data-countup-value') || '';
|
|
var target = parseFloat(raw.replace(/[^0-9.\-]/g, ''));
|
|
if (isNaN(target)) return;
|
|
var decimals = (raw.split('.')[1] || '').length;
|
|
var start = null, dur = 1200;
|
|
function step(ts){
|
|
if (start === null) start = ts;
|
|
var p = Math.min((ts - start) / dur, 1);
|
|
var eased = 1 - Math.pow(1 - p, 3);
|
|
node.textContent = (target * eased).toFixed(decimals);
|
|
if (p < 1) requestAnimationFrame(step);
|
|
else node.textContent = target.toFixed(decimals);
|
|
}
|
|
requestAnimationFrame(step);
|
|
});
|
|
}
|
|
sections.forEach(function(section){
|
|
if (reduce || !('IntersectionObserver' in window)) return;
|
|
var io = new IntersectionObserver(function(entries){
|
|
entries.forEach(function(e){
|
|
if (e.isIntersecting){ animate(section); io.disconnect(); }
|
|
});
|
|
}, { threshold: 0.3 });
|
|
io.observe(section);
|
|
});
|
|
})();
|
|
</script>{% endif %}
|