themes-earthen/templates/overrides/earthen/rich-section.ninjatpl
Alex Dunmow ad1a1d83aa fix(earthen): repair blank hero (.text hard-error) + trim section whitespace
Hero blank-band bug (root cause):
- The hero override read styled-text fields as `field.text|default:field`
  (eyebrow/headline/subheadline/description). The ninjatpl engine hard-errors
  on attribute-access-against-a-bare-string, and the demo seed passes these
  fields as bare strings, so the whole hero errored and rendered as an empty
  ~75vh band on the landing page. Switched to `field|get:"text"|default:field`
  — the process-global `get` filter degrades gracefully on a bare string
  (returns nothing, so `|default:` falls back to the string) and still reads
  `.text` from the admin/editor `{text,color}` object form. Matches the fixed
  sibling lanes (terminal, scifi-clean). navbar `cta.text` left as-is: that
  field is always a link object, never a bare string (terminal did the same).

Whitespace pass:
- Trimmed oversized marketing section padding py-16 md:py-24 -> py-12 md:py-20
  across 15 blocks (cta, feature-grid, pricing, stats, team, testimonial,
  timeline, faq, countdown, rich-section, contact-card, contact-form,
  event-list, menu-list, hours-location) to remove dead inter-section bands.
  Tailwind classes only — the host Tailwind build now scans theme .ninjatpl,
  so responsive utilities compile; no duplicate hand-rolled media-query CSS
  added.

No new CSS (earthen's manifest CSS is all bespoke aesthetic — nothing
duplicated a utility). No scroll-reveal system exists to harden; the stats
count-up already no-ops under reduced-motion / no-JS and renders final values.
Codeless build OK (earthen@0.2.1). check-safety: 32 checks 19 ok 13 skip -> OK.
No version bump.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 17:52:46 +08:00

15 lines
2.1 KiB
Plaintext

{# rich-section override — earthen: paper ground, botanical eyebrow rule, Fraunces heading with crayon underline, organic media frame. Field reads, background/mediaPosition order control flow, body|safe and the {% img %} call preserved verbatim from the builtin; only classes/style/fonts reskinned. #}
<section data-block-override="earthen:rich-section" class="py-12 md:py-20 {% if background == "muted" %}bg-muted text-foreground{% elif background == "card" %}bg-card text-card-foreground{% else %}bg-background text-foreground{% endif %}{% if class %} {{ class }}{% endif %}">
<div class="mx-auto grid max-w-6xl items-center gap-10 px-4 md:grid-cols-2 md:gap-16">
<div class="{% if mediaPosition == "left" %}md:order-2{% else %}md:order-1{% endif %}">
{% if eyebrow %}<div class="mb-3 flex items-center gap-3"><span class="h-px w-8" style="background-color:hsl(var(--accent));"></span><p class="text-xs font-semibold uppercase tracking-wider" style="color:hsl(var(--primary));">{{ eyebrow }}</p></div>{% endif %}
{% if heading %}<h2 class="mt-2 inline-block crayon-underline text-3xl md:text-4xl font-semibold" style="font-family:var(--font-heading, 'Fraunces', 'Playfair Display', Georgia, serif);color:hsl(var(--primary))">{{ heading }}</h2>{% endif %}
{% if body %}<div class="mt-4 space-y-4 text-lg text-muted-foreground [&_a]:text-primary [&_a]:underline [&_strong]:text-foreground" style="font-family:var(--font-body, 'Work Sans', ui-sans-serif, system-ui, sans-serif)">{{ body|safe }}</div>{% endif %}
{% if ctaUrl and ctaLabel %}<a href="{{ ctaUrl }}" class="earthen-cta mt-6 inline-flex items-center gap-2 px-5 py-3 font-semibold">{{ ctaLabel }}<svg class="h-4 w-4" aria-hidden="true"><use href="/icons/lucide.svg#arrow-right"></use></svg></a>{% endif %}
</div>
<div class="{% if mediaPosition == "left" %}md:order-1{% else %}md:order-2{% endif %}">
{% if media %}<div class="earthen-blob-soft earthen-paper-frame overflow-hidden">{% img media alt=mediaAlt class="w-full h-auto object-cover" %}</div>{% endif %}
</div>
</div>
</section>