themes-coffee/hours_strip.templ
Alex Dunmow 11c6c8c63e initial: theme plugin coffee
Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously
an unversioned directory inside ~/src/blockninja-themes/coffee.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-06 14:11:22 +08:00

36 lines
1.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package main
// hoursStripComponent renders the hours strip with the today row highlighted.
templ hoursStripComponent(data HoursStripData) {
<aside data-block="coffee:hours_strip" class="my-4">
<ul class="coffee-card grid grid-cols-1 sm:grid-cols-2 md:grid-cols-7 gap-1 p-2 max-w-5xl mx-auto">
if len(data.Rows) == 0 {
<li class="coffee-body text-sm text-muted-foreground italic px-3 py-2 col-span-full text-center">Add weekday hours to display the strip.</li>
}
for _, row := range data.Rows {
<li class={ "coffee-body px-2 py-1 flex items-baseline gap-2 text-sm rounded-sm", todayClass(row.IsToday) }>
<span class="coffee-display font-semibold text-foreground w-12 shrink-0">{ row.Day }</span>
if row.IsToday {
<span class="coffee-body text-[10px] uppercase tracking-wider text-accent">{ data.TodayLabel }</span>
}
<span class="coffee-mono text-foreground">
if row.Open != "" || row.Close != "" {
{ row.Open } { row.Close }
} else {
Closed
}
</span>
</li>
}
</ul>
</aside>
}
// todayClass returns the highlight class when this row is today's.
func todayClass(isToday bool) string {
if isToday {
return "coffee-hours-today is-today today"
}
return ""
}