feat(home): make brew cards clickable, linking to detail page

Change brew card from div to anchor element with hover border effect.
Brew Again button uses preventDefault to avoid navigating to the detail
page when clicked.
This commit is contained in:
Jon Seager 2026-02-08 16:10:21 +00:00
parent eaf558a524
commit ffee36ea41
No known key found for this signature in database

View file

@ -1,6 +1,6 @@
{% import "partials/icons.html" as icons %} {% import "partials/icons.html" as icons %}
{% macro card(brew, is_authenticated) %} {% macro card(brew, is_authenticated) %}
<div class="relative w-[45vw] md:w-[200px] h-[279px] shrink-0 snap-start rounded-lg border bg-surface p-4 flex flex-col"> <a href="/brews/{{ brew.id }}" class="relative w-[45vw] md:w-[200px] h-[279px] shrink-0 snap-start rounded-lg border bg-surface p-4 flex flex-col transition hover:border-accent/40">
<div class="h-[4.5rem] overflow-hidden"> <div class="h-[4.5rem] overflow-hidden">
<span class="block font-semibold text-text truncate">{{ brew.roast_name }}</span> <span class="block font-semibold text-text truncate">{{ brew.roast_name }}</span>
<p class="mt-0.5 text-sm text-text-muted truncate">{{ brew.roaster_name }}</p> <p class="mt-0.5 text-sm text-text-muted truncate">{{ brew.roaster_name }}</p>
@ -13,13 +13,13 @@
{% if !brew.quick_notes.is_empty() %}<p class="truncate">{{ brew.quick_notes_label }}</p>{% endif %} {% if !brew.quick_notes.is_empty() %}<p class="truncate">{{ brew.quick_notes_label }}</p>{% endif %}
</div> </div>
{% if is_authenticated %} {% if is_authenticated %}
<div class="mt-3"> <div class="relative z-10 mt-3">
<a href="{{ brew.brew_again_url() }}" <span onclick="event.preventDefault(); window.location.href='{{ brew.brew_again_url() }}';"
class="inline-flex h-8 w-full items-center justify-center gap-1.5 rounded-md border px-2 text-sm font-medium text-accent transition hover:text-accent-hover hover:bg-surface-alt"> class="inline-flex h-8 w-full items-center justify-center gap-1.5 rounded-md border px-2 text-sm font-medium text-accent transition hover:text-accent-hover hover:bg-surface-alt cursor-pointer">
{{ icons::beaker("h-4 w-4") }} {{ icons::beaker("h-4 w-4") }}
Brew Again Brew Again
</a> </span>
</div> </div>
{% endif %} {% endif %}
</div> </a>
{% endmacro %} {% endmacro %}