99 lines
4.0 KiB
Plaintext
99 lines
4.0 KiB
Plaintext
{% liquid
|
|
assign search_heading = search.terms | remove: '*' | strip
|
|
if search_heading == blank
|
|
assign search_heading = 'search.title' | t
|
|
endif
|
|
%}
|
|
|
|
<section class="search-page full-width">
|
|
<div class="search-page__body">
|
|
<h1 class="search-page__title">{{ search_heading | escape }}</h1>
|
|
|
|
<form class="search-page__form" action="{{ routes.search_url }}" method="get" role="search">
|
|
<button class="search-page__submit" type="submit" aria-label="{{ 'search.submit' | t }}">
|
|
<span class="search-page__icon" aria-hidden="true">
|
|
{{ 'icon-search.svg' | inline_asset_content }}
|
|
</span>
|
|
</button>
|
|
<label class="sr-only" for="SearchPage-{{ section.id }}">{{ 'search.title' | t }}</label>
|
|
<input
|
|
id="SearchPage-{{ section.id }}"
|
|
class="search-page__input"
|
|
type="search"
|
|
name="q"
|
|
value="{{ search.terms | escape }}"
|
|
placeholder="{{ 'search.placeholder' | t }}"
|
|
>
|
|
</form>
|
|
|
|
{% if search.performed %}
|
|
{% if search.results_count == 0 %}
|
|
<p class="search-page__empty">{{ 'search.no_results_html' | t: terms: search_heading }}</p>
|
|
{% else %}
|
|
<p class="search-page__count">{{ 'search.results_for_html' | t: terms: search_heading, count: search.results_count }}</p>
|
|
|
|
{% paginate search.results by 9 %}
|
|
<div class="search-page__grid">
|
|
{% for result in search.results %}
|
|
{% if result.object_type == 'product' %}
|
|
{% assign card_suffix = section.id | append: '-' | append: forloop.index %}
|
|
{% render 'collection-card', product: result, form_suffix: card_suffix %}
|
|
{% else %}
|
|
{% assign result_image = result.image | default: result.featured_image %}
|
|
<article class="search-page__other">
|
|
<a class="search-page__other-link" href="{{ result.url }}">
|
|
<span class="search-page__other-media">
|
|
{% if result_image %}
|
|
{{
|
|
result_image
|
|
| image_url: width: 800
|
|
| image_tag:
|
|
alt: '',
|
|
widths: '186, 372, 560, 800',
|
|
sizes: '(max-width: 767px) 46vw, 33vw',
|
|
loading: 'lazy'
|
|
}}
|
|
{% endif %}
|
|
</span>
|
|
<span class="search-page__other-title">{{ result.title | escape }}</span>
|
|
</a>
|
|
</article>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{% if paginate.pages > 1 %}
|
|
<nav class="search-page__pages" aria-label="{{ 'collection_page.page' | t: page: paginate.current_page }}">
|
|
{% for part in paginate.parts %}
|
|
{% if part.is_link %}
|
|
<a class="search-page__page" href="{{ part.url }}">{{ part.title }}</a>
|
|
{% elsif part.title == paginate.current_page %}
|
|
<span class="search-page__page is-current" aria-current="page">{{ part.title }}</span>
|
|
{% else %}
|
|
<span class="search-page__page search-page__page--gap">{{ part.title }}</span>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% if paginate.next %}
|
|
<a class="search-page__next" href="{{ paginate.next.url }}" aria-label="{{ 'collection_page.next_page' | t }}">
|
|
<svg width="20" height="20" viewBox="0 0 20 20" aria-hidden="true" focusable="false">
|
|
<path d="M7 4.5 12.5 10 7 15.5" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
</svg>
|
|
</a>
|
|
{% endif %}
|
|
</nav>
|
|
{% endif %}
|
|
{% endpaginate %}
|
|
{% endif %}
|
|
{% endif %}
|
|
</div>
|
|
</section>
|
|
|
|
|
|
|
|
{% schema %}
|
|
{
|
|
"name": "t:general.search",
|
|
"settings": []
|
|
}
|
|
{% endschema %}
|