diff --git a/assets/findify-grid.css b/assets/findify-grid.css index 8efbc26..b9cd2bf 100644 --- a/assets/findify-grid.css +++ b/assets/findify-grid.css @@ -1,34 +1,33 @@ -.findify-search-section.findify-filters-right .findify-desktop{ +.findify-search-section.findify-filters-right .findify-desktop { overflow: hidden; } .findify-search-section.findify-filters-right .findify-desktop .findify-search-header-toolbar, -.findify-search-section.findify-filters-right .findify-search-main{ +.findify-search-section.findify-filters-right .findify-search-main { flex-direction: row-reverse; } .findify-search-section.findify-filters-right .findify-search-main { flex-direction: row-reverse; } @media (min-width: 768px) { - .findify-search-section.findify-filters-horizontal .findify-search-main{ + .findify-search-section.findify-filters-horizontal .findify-search-main { flex-wrap: wrap; } - .findify-search-section.findify-filters-horizontal .findify-filters-sidebar.findify-open{ + .findify-search-section.findify-filters-horizontal .findify-filters-sidebar.findify-open { width: 100%; flex-wrap: wrap; } - .findify-search-section.findify-filters-horizontal .findify-filters-wrapper{ + .findify-search-section.findify-filters-horizontal .findify-filters-wrapper { width: 100%; flex-direction: row; flex-wrap: wrap; max-width: 1100px; } - .findify-search-section.findify-filters-horizontal #shopify-section-findify-filter-group{ + .findify-search-section.findify-filters-horizontal #shopify-section-findify-filter-group { min-width: 220px; max-width: 220px; } } - .findify-initialization { display: flex; min-height: 800px; @@ -147,7 +146,7 @@ b { display: none; } - .findify-search-section.findify-filters-drawer .findify-search-header.findify-mobile{ + .findify-search-section.findify-filters-drawer .findify-search-header.findify-mobile { display: block; } .findify-search-header.findify-mobile { @@ -185,3 +184,24 @@ b { /* grid-template-columns: 1fr 1fr; */ } } +/* grid toggler */ +.findify-grid-togglers { + display: flex; + margin-right: 10px; + gap: 12px; +} +.findify-grid-toggler.findify-active rect { + fill: #4e4e4e; +} +.findify-toolbar-block { + display: flex; +} +.findify-mobile { + .findify-toolbar-block { + justify-content: space-between; + } + .findify-grid-toggler svg { + width: 15px; + height: 15px; + } +} diff --git a/sections/findify-grid-collection.liquid b/sections/findify-grid-collection.liquid index 7a3f14b..268c31d 100644 --- a/sections/findify-grid-collection.liquid +++ b/sections/findify-grid-collection.liquid @@ -11,7 +11,13 @@ {%- assign all_filters_collapsed = query_parameters | split: 'all_filters_collapsed:' | last | split: '|' | first | split: '&' | first -%} {%- assign sticky_filters = query_parameters | split: 'sticky_filters:' | last | split: '|' | first | split: '&' | first -%} {%- assign disable_search_input = query_parameters | split: 'disable_search_input:' | last | split: '|' | first | split: '&' | first -%} - +{%- assign use_grid_toggler_on_desktop = query_parameters | split: 'use_grid_toggler_on_desktop:' | last | split: '|' | first | split: '&' | first -%} +{%- assign use_grid_toggler_on_mobile = query_parameters | split: 'use_grid_toggler_on_mobile:' | last | split: '|' | first | split: '&' | first -%} +{% if mobile_products_per_view == '1' %} + {% assign mobile_products_per_view_alt = '2' %} +{% else %} + {% assign mobile_products_per_view_alt = '1' %} +{% endif %} {% endif %} -
+
{% comment %} This element #findify-product-grid will be populated with rendered html from sections/findify-products.liquid {% endcomment %} @@ -119,17 +131,23 @@ {% endif %}
+ @media (min-width: 768px) { + #findify-product-grid.findify-product-list[data-template='main'] { + grid-template-columns: repeat({{desktop_products_per_view}}, minmax(180px, 1fr)); + } + #findify-product-grid.findify-product-list[data-template='alt'] { + grid-template-columns: repeat({{desktop_products_per_view_alt}}, minmax(180px, 1fr)); + } + } + @media (max-width: 576px) { + #findify-product-grid.findify-product-list[data-template='main'] { + grid-template-columns: repeat({{mobile_products_per_view}}, minmax(180px, 1fr)); + } + #findify-product-grid.findify-product-list[data-template='alt'] { + grid-template-columns: repeat({{mobile_products_per_view_alt}}, minmax(180px, 1fr)); + } + } + diff --git a/snippets/findify-toolbar-desktop.liquid b/snippets/findify-toolbar-desktop.liquid index 7d5b28b..4858ed4 100644 --- a/snippets/findify-toolbar-desktop.liquid +++ b/snippets/findify-toolbar-desktop.liquid @@ -21,13 +21,14 @@ , query_type: query_type %} -
- {% render 'findify-sorting', - options: sort_options, - default: default_sort_by, - selected: sort_by, - is_modal: false - %} +
+ {% if use_grid_toggler == 'true' %} + {% render 'findify-grid-toggler' parent_selector: 'findify-desktop' + , products_per_view_alt: products_per_view_alt + , products_per_view: products_per_view + %} + {% endif %} + {% render 'findify-sorting', options: sort_options, default: default_sort_by, selected: sort_by, is_modal: false %}
{% if active_filters != 'none' %} diff --git a/snippets/findify-toolbar-mobile.liquid b/snippets/findify-toolbar-mobile.liquid index 64ea3a8..1508ff5 100644 --- a/snippets/findify-toolbar-mobile.liquid +++ b/snippets/findify-toolbar-mobile.liquid @@ -4,11 +4,20 @@ %}
- {% - render 'findify-query' terms: terms, results_count: results_count, is_collection: is_collection, , terms: terms - , corrected_q: corrected_q - , query_type: query_type - %} +
+ {% + render 'findify-query' terms: terms, results_count: results_count, is_collection: is_collection, , terms: terms + , corrected_q: corrected_q + , query_type: query_type + %} + {% if use_grid_toggler == 'true' %} + {% render 'findify-grid-toggler' is_mobile: true + , parent_selector: 'findify-mobile' + , products_per_view_alt: products_per_view_alt + , products_per_view: products_per_view + %} + {% endif %} +