{% macro stars(tenths, label, size="small") -%} {%- set filled = (tenths + 5) // 10 -%} {%- for index in range(5) -%} {%- endfor -%} {%- endmacro %} {% macro product_image(product) -%}
{% if product.stock == 0 or product.compare_at_cents is not none %}
{% if product.stock == 0 %}Sold out{% endif %} {% if product.compare_at_cents is not none %}Sale{% endif %}
{% endif %}
{%- endmacro %} {% macro product_card(product) -%}
{{ product_image(product) }}

{{ product.category }}

{{ product.name }}

{{ product.tagline }}

{% set rating = product.rating|rating %}
{{ stars(product.rating_tenths, rating) }} {{ rating }} ({{ product.review_count|count }})

{{ product.price_cents|money }} {% if product.compare_at_cents is not none %}{{ product.compare_at_cents|money }}{% endif %}

{{ product.palette.label }}
{% if 1 <= product.stock <= 9 %}

Only {{ product.stock }} left

{% endif %}
{%- endmacro %} {% macro breadcrumbs(trail, current) -%} {%- endmacro %} {% macro pagination(pages) -%} {%- endmacro %} {% macro status_badge(status) -%} Pending {%- elif status == "paid" %} bg-sky-50 text-sky-800 ring-sky-600/20">Paid {%- elif status == "shipped" %} bg-indigo-50 text-indigo-700 ring-indigo-600/20">Shipped {%- elif status == "delivered" %} bg-emerald-50 text-emerald-800 ring-emerald-600/20">Delivered {%- elif status == "refunded" %} bg-stone-100 text-stone-700 ring-stone-500/20">Refunded {%- else %} bg-rose-50 text-rose-700 ring-rose-600/20">Cancelled {%- endif %} {%- endmacro %}