themes-noir/templates/overrides/noir/blog-hero.ninjatpl
Alex Dunmow 65457ca821 fix(noir): hero .text seed-safe + revert layout CSS to Tailwind utilities
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>
2026-07-05 17:55:03 +08:00

25 lines
2.1 KiB
Plaintext

{# noir override — blog-hero; preserves title, subtitle, posts provider loop, post.featured_image_url/.url/.title/.excerpt/.author_name/.published_at, showExcerpt, forloop.First. {% img %} kept verbatim. #}
<section data-block-override="noir:blog-hero" class="bg-background py-12 text-foreground md:py-16{% if class %} {{ class }}{% endif %}">
<div class="mx-auto max-w-6xl px-4">
<div class="max-w-2xl">
{% if title %}<h1 class="noir-heading text-4xl md:text-5xl" style="color:hsl(var(--foreground));">{{ title }}</h1>{% endif %}
{% if subtitle %}<p class="noir-body mt-3 text-lg" style="color:hsl(var(--muted-foreground));">{{ subtitle }}</p>{% endif %}
</div>
{% if posts %}
<div class="mt-10 grid grid-cols-1 gap-6 md:grid-cols-3">
{% for post in posts %}
<article class="group flex flex-col{% if forloop.First %} md:col-span-3 md:flex-row md:items-stretch md:gap-6{% endif %}">
{% if post.featured_image_url %}<a href="{{ post.url }}" class="mb-3 block overflow-hidden bg-muted grayscale{% if forloop.First %} md:mb-0 md:w-1/2{% endif %}">{% img post.featured_image_url alt=post.title class="aspect-video h-full w-full object-cover transition-transform duration-300 group-hover:scale-105" %}</a>{% endif %}
<div class="flex flex-col justify-center{% if forloop.First %} md:w-1/2{% endif %}">
<span class="noir-rule mb-4 block w-12"></span>
<h2 class="noir-heading {% if forloop.First %}text-2xl{% else %}text-lg{% endif %} leading-snug" style="color:hsl(var(--foreground));"><a href="{{ post.url }}" class="transition-colors hover:text-primary">{{ post.title }}</a></h2>
{% if showExcerpt and post.excerpt %}<p class="noir-body mt-2 text-sm" style="color:hsl(var(--muted-foreground));">{{ post.excerpt }}</p>{% endif %}
<div class="mt-3 flex flex-wrap items-center gap-x-3 noir-label">{% if post.author_name %}<span style="color:hsl(var(--primary));">{{ post.author_name }}</span>{% endif %}{% if post.published_at %}<span style="color:hsl(var(--muted-foreground));">{{ post.published_at|date:"M j, Y" }}</span>{% endif %}</div>
</div>
</article>
{% endfor %}
</div>
{% endif %}
</div>
</section>