themes-earthen/templates/overrides/earthen/hours-location.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

32 lines
3.3 KiB
Plaintext

{# hours-location override — cream hours ledger + soft-cornered map facade. Map facade <button onclick> preserved verbatim. Fields mirror builtin: heading, hours[].day/.hours/.closed, specialHoursNote, address, phone, directionsUrl, mapEmbedUrl, mapButtonLabel. #}
<section data-block-override="earthen:hours-location" class="py-12 md:py-20 bg-background text-foreground{% if class %} {{ class }}{% endif %}">
<div class="mx-auto max-w-5xl px-4">
{% if heading %}<h2 class="text-3xl md:text-4xl font-semibold text-center" style="font-family:var(--font-heading, 'Fraunces', 'Playfair Display', Georgia, serif);color:hsl(var(--primary));">{{ heading }}</h2>{% endif %}
<div class="mt-10 grid grid-cols-1 gap-10 md:grid-cols-2">
<div class="earthen-panel earthen-blob-soft p-6 md:p-8">
{% if hours %}
<table class="w-full text-sm">
<tbody class="divide-y" style="border-color:hsl(var(--border));">
{% for row in hours %}
<tr style="border-color:hsl(var(--border));">
<th scope="row" class="py-2 pr-4 text-left text-xs font-semibold uppercase tracking-wide" style="color:hsl(var(--foreground));">{{ row.day }}</th>
<td class="py-2 text-right tabular-nums {% if row.closed %}italic{% endif %}" style="{% if row.closed %}color:hsl(var(--muted-foreground));{% else %}color:hsl(var(--accent));{% endif %}">{% if row.closed %}Closed{% else %}{{ row.hours }}{% endif %}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% if specialHoursNote %}<p class="mt-4 border-t pt-3 text-sm italic" style="border-color:hsl(var(--border));color:hsl(var(--muted-foreground));">{{ specialHoursNote }}</p>{% endif %}
{% if address %}<div class="mt-6"><div class="text-xs font-semibold uppercase tracking-wide" style="color:hsl(var(--primary));">Address</div><address class="mt-1 whitespace-pre-line not-italic" style="font-family:var(--font-body, 'Work Sans', ui-sans-serif, system-ui, sans-serif);">{{ address }}</address></div>{% endif %}
{% if phone %}<div class="mt-4"><div class="text-xs font-semibold uppercase tracking-wide" style="color:hsl(var(--primary));">Phone</div><a href="tel:{{ phone }}" class="earthen-link mt-1 inline-block">{{ phone }}</a></div>{% endif %}
{% if directionsUrl %}<a href="{{ directionsUrl }}" target="_blank" rel="noopener noreferrer" class="earthen-cta mt-6 inline-flex items-center gap-2 px-5 py-2.5 font-semibold">::lucide:navigation:sm:: Get directions</a>{% endif %}
</div>
{% if mapEmbedUrl %}
<div class="earthen-blob-soft aspect-square w-full overflow-hidden bg-muted md:aspect-auto">
<button type="button" data-map-src="{{ mapEmbedUrl }}" onclick="var f=document.createElement('iframe');f.src=this.getAttribute('data-map-src');f.setAttribute('class','h-full w-full border-0');f.setAttribute('loading','lazy');f.setAttribute('referrerpolicy','no-referrer-when-downgrade');f.setAttribute('title','Map');this.parentNode.replaceChild(f,this);" class="flex h-full min-h-[16rem] w-full items-center justify-center gap-2 text-sm font-semibold transition-colors hover:bg-accent hover:text-accent-foreground" style="color:hsl(var(--primary));">::lucide:map-pin:md:: {{ mapButtonLabel|default:"Load map" }}</button>
</div>
{% endif %}
</div>
</div>
</section>