Demas ajustes
This commit is contained in:
+84
-56
@@ -1,66 +1,94 @@
|
||||
{% comment %}
|
||||
This section is used in the search template to render search results for
|
||||
products, articles, and pages.
|
||||
{% liquid
|
||||
assign search_heading = search.terms | remove: '*' | strip
|
||||
if search_heading == blank
|
||||
assign search_heading = 'search.title' | t
|
||||
endif
|
||||
%}
|
||||
|
||||
https://shopify.dev/docs/storefronts/themes/architecture/templates/search
|
||||
{% endcomment %}
|
||||
<section class="search-page full-width">
|
||||
<div class="search-page__body">
|
||||
<h1 class="search-page__title">{{ search_heading | escape }}</h1>
|
||||
|
||||
<h1>{{ 'search.title' | t }}</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>
|
||||
|
||||
<form action="{{ routes.search_url }}" method="get" role="search">
|
||||
<input
|
||||
type="search"
|
||||
size="50"
|
||||
name="q"
|
||||
value="{{ search.terms | escape }}"
|
||||
placeholder="{{ 'search.placeholder' | t }}"
|
||||
>
|
||||
<button type="submit">{{ 'search.submit' | t }}</button>
|
||||
</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>
|
||||
|
||||
{% if search.performed %}
|
||||
{% if search.results_count == 0 %}
|
||||
<p>{{ 'search.no_results_html' | t: terms: search.terms }}</p>
|
||||
{% else %}
|
||||
<p>{{ 'search.results_for_html' | t: terms: search.terms, count: search.results_count }}</p>
|
||||
|
||||
<div class="search-results">
|
||||
{% paginate search.results by 20 %}
|
||||
{% # Search result items may be an article, a page, or a product. %}
|
||||
{% for result in search.results %}
|
||||
<div class="search-result">
|
||||
{% assign featured_image = result.featured_image | default: result.image %}
|
||||
{% if featured_image %}
|
||||
{% render 'image', class: 'search-result__image', image: featured_image, url: result.url, width: 400 %}
|
||||
{% endif %}
|
||||
<div class="search-result__content">
|
||||
<p>
|
||||
{{ result.title | link_to: result.url }}
|
||||
{% if result.price %}
|
||||
{{ result.price | money_with_currency }}
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
{% 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>
|
||||
{% endfor %}
|
||||
|
||||
{{ paginate | default_pagination }}
|
||||
{% endpaginate %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% 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>
|
||||
|
||||
|
||||
{% stylesheet %}
|
||||
.search-results {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||
}
|
||||
.search-results .prev,
|
||||
.search-results .page,
|
||||
.search-results .next {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
{% endstylesheet %}
|
||||
|
||||
{% schema %}
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user