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

44 lines
4.8 KiB
Plaintext

{# contact-form override — SEED-CRITICAL. ALL form wiring preserved verbatim from builtin: bid, {% form %} action/hx attrs, honeypot input name, field loop, form.submitted/errors, submit target. Only inputs restyled and copy reworded to earthen. #}
{% with bid=_block_id|default:context.blockId %}
<section data-block-override="earthen:contact-form" id="contact-form-{{ bid }}" class="py-12 md:py-20 bg-background text-foreground{% if class %} {{ class }}{% endif %}">
<div class="mx-auto max-w-2xl px-4">
{% if form.submitted %}
<div class="earthen-panel earthen-blob-soft p-10 text-center">
<div class="mx-auto mb-4 inline-flex h-12 w-12 items-center justify-center rounded-full" style="background-color:hsl(var(--primary)/0.12);color:hsl(var(--primary));">::lucide:check:lg::</div>
<p class="text-lg italic" style="font-family:var(--font-body, 'Work Sans', ui-sans-serif, system-ui, sans-serif);">{{ form.message|default:successMessage|default:"Thank you. Your message has been received." }}</p>
</div>
{% else %}
<div class="text-center">
{% if heading %}<h2 class="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 description %}<p class="mt-3 text-lg italic" style="color:hsl(var(--muted-foreground));font-family:var(--font-body, 'Work Sans', ui-sans-serif, system-ui, sans-serif);">{{ description }}</p>{% endif %}
<div class="mx-auto mt-5 mb-2 flex justify-center" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="28" height="28" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" style="color:hsl(var(--primary));"><path d="M24 44V8"></path><path d="M24 12c-4-2-7-2-9 0M24 12c4-2 7-2 9 0"></path><path d="M24 18c-6-2-10-1-12 1M24 18c6-2 10-1 12 1"></path><path d="M24 25c-7-1-12 0-14 3M24 25c7-1 12 0 14 3"></path><path d="M24 33c-7 0-11 2-12 5M24 33c7 0 11 2 12 5"></path></svg></div>
</div>
{% if form.errors._form %}<div class="mt-6 rounded-md border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm text-destructive">{{ form.errors._form }}</div>{% endif %}
{% with formAction="/api/blocks/"|add:bid|add:"/submit" formTarget="#contact-form-"|add:bid %}
{% form action=formAction hx_target=formTarget hx_swap="outerHTML" class="mt-8 grid grid-cols-1 gap-5 sm:grid-cols-2" %}
{% for field in fields %}
<div class="{% if field.width == "half" %}sm:col-span-1{% else %}sm:col-span-2{% endif %}">
{% if field.label %}<label for="cf-{{ bid }}-{{ field.name }}" class="mb-1.5 block text-xs font-semibold uppercase tracking-wide" style="color:hsl(var(--primary));">{{ field.label }}{% if field.required %} <span class="text-destructive">*</span>{% endif %}</label>{% endif %}
{% if field.type == "textarea" %}
<textarea id="cf-{{ bid }}-{{ field.name }}" name="{{ field.name }}" rows="5"{% if field.required %} required{% endif %}{% if field.placeholder %} placeholder="{{ field.placeholder }}"{% endif %} class="w-full rounded-lg border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:border-[hsl(var(--primary))] focus:ring-1 focus:ring-ring"></textarea>
{% elif field.type == "select" %}
<select id="cf-{{ bid }}-{{ field.name }}" name="{{ field.name }}"{% if field.required %} required{% endif %} class="w-full rounded-lg border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:border-[hsl(var(--primary))] focus:ring-1 focus:ring-ring">
{% if field.placeholder %}<option value="">{{ field.placeholder }}</option>{% endif %}
{% for opt in field.options %}<option value="{{ opt.value }}">{{ opt.label|default:opt.value }}</option>{% endfor %}
</select>
{% else %}
<input id="cf-{{ bid }}-{{ field.name }}" name="{{ field.name }}" type="{{ field.type|default:"text" }}"{% if field.required %} required{% endif %}{% if field.placeholder %} placeholder="{{ field.placeholder }}"{% endif %} class="w-full rounded-lg border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:border-[hsl(var(--primary))] focus:ring-1 focus:ring-ring">
{% endif %}
</div>
{% endfor %}
<div class="hidden" aria-hidden="true"><label>Leave this field empty<input type="text" name="website" tabindex="-1" autocomplete="off"></label></div>
<div class="sm:col-span-2 flex justify-center">
<button type="submit" class="earthen-cta inline-flex items-center justify-center px-6 py-3 font-semibold">{{ submitLabel|default:"Send message" }}</button>
</div>
{% endform %}
{% endwith %}
{% endif %}
</div>
</section>
{% endwith %}