themes-noir/templates/overrides/noir/featured-posts.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

23 lines
2.0 KiB
Plaintext

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