-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michał Skorus
committed
May 19, 2024
1 parent
e6a71bf
commit bc18289
Showing
25 changed files
with
536 additions
and
216 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import '../styles/index.scss'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import 'swiper/css'; | ||
|
||
import '../styles/products-slider-top.scss'; | ||
|
||
import { Swiper } from 'swiper'; | ||
import { Navigation } from 'swiper/modules'; | ||
|
||
Swiper.use([Navigation]); | ||
|
||
new Swiper('.x-products-slider-top__swiper', { | ||
direction: 'horizontal', | ||
loop: false, | ||
spaceBetween: 16, | ||
slidesPerView: 1.3, | ||
|
||
speed: 100, | ||
grabCursor: true, | ||
freeMode: true, | ||
|
||
breakpoints: { | ||
600: { | ||
slidesPerView: 2.3, | ||
spaceBetween: 16, | ||
}, | ||
768: { | ||
slidesPerView: 3.3, | ||
spaceBetween: 16, | ||
}, | ||
1024: { | ||
slidesPerView: 3.3, | ||
spaceBetween: 24, | ||
speed: 200, | ||
}, | ||
1240: { | ||
slidesPerView: 4.3, | ||
spaceBetween: 24, | ||
}, | ||
}, | ||
|
||
navigation: { | ||
nextEl: '.swiper-button-next', | ||
prevEl: '.swiper-button-prev', | ||
}, | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
<script src="{{ 'x-products-slider-top.js' | asset_url }}" type="module"></script> | ||
{{ 'x-products-slider-top.css' | asset_url | stylesheet_tag }} | ||
|
||
{% assign filter_tag = 'Bestseller' %} | ||
{% assign product_limit = section.settings.slider_limit %} | ||
{% assign filtered_product_ids = "" %} | ||
|
||
{% for collection in product.collections %} | ||
{% for product in collection.products %} | ||
{% for tag in product.tags %} | ||
{% if filter_tag contains tag %} | ||
{% if filtered_product_ids == blank %} | ||
{% assign filtered_product_ids = filtered_product_ids | append: product.id %} | ||
{% else %} | ||
{% assign filtered_product_ids = filtered_product_ids | append: "," | append: product.id %} | ||
{% endif %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endfor %} | ||
{% endfor %} | ||
|
||
{% assign filtered_product_ids = filtered_product_ids | split: "," | uniq %} | ||
|
||
{% assign pre = 'x-products-slider-top' %} | ||
|
||
<div class="{{pre}}"> | ||
<div class="content-wrapper"> | ||
<div class="{{pre}}__header"> | ||
<h2 class="{{pre}}__title">{{section.settings.slider_title}}</h2> | ||
<a href="{{section.settings.button_link}}" class="{{pre}}__button-link {{pre}}__button-link--desktop"> | ||
<button class="x-button"> | ||
{{section.settings.button_text}} | ||
</button> | ||
</a> | ||
</div> | ||
{% if filtered_product_ids.size > 0 %} | ||
<div class="swiper x-products-slider-top__swiper"> | ||
<div class="swiper-wrapper"> | ||
{% for id in filtered_product_ids limit: product_limit %} | ||
{% for collection in product.collections %} | ||
{% for product in collection.products %} | ||
{% if id contains product.id %} | ||
{% assign found_product = product %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endfor %} | ||
{% if found_product %} | ||
<div class="swiper-slide"> | ||
{% render 'product-card', product: found_product %} | ||
</div> | ||
{% endif %} | ||
{% endfor %} | ||
</div> | ||
|
||
<div class="swiper-button-prev"> | ||
<div class="swiper-navigation-button"> | ||
<div class="swiper-navigation-icon-wrapper"> | ||
{% render 'icon-chevron-left' %} | ||
</div> | ||
</div> | ||
</div> | ||
<div class="swiper-button-next"> | ||
<div class="swiper-navigation-button"> | ||
<div class="swiper-navigation-icon-wrapper"> | ||
{% render 'icon-chevron-right' %} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% else %} | ||
<p class="{{pre}}__not-found">{{section.settings.not_found_message}}</p> | ||
{% endif %} | ||
<a href="{{section.settings.button_link}}" class="{{pre}}__button-link {{pre}}__button-link--mobile"> | ||
<button class="x-button"> | ||
{{section.settings.button_text}} | ||
</button> | ||
</a> | ||
</div> | ||
</div> | ||
|
||
|
||
{% schema %} | ||
{ | ||
"name": "Top Products Slider", | ||
"tag": "section", | ||
"class": "section", | ||
"enabled_on": { | ||
"templates": ["product"] | ||
}, | ||
"settings": [ | ||
{ | ||
"type": "text", | ||
"id": "slider_title", | ||
"label": "Slider Title", | ||
"default": "Bestseller Products" | ||
}, | ||
{ | ||
"type": "range", | ||
"id": "slider_limit", | ||
"label": "Slider Limit", | ||
"default": 10, | ||
"min": 1, | ||
"max": 30, | ||
"step": 1 | ||
}, | ||
{ | ||
"type": "text", | ||
"id": "not_found_message", | ||
"label": "No products message", | ||
"default": "Sorry, we couldn't find any products." | ||
}, | ||
{ | ||
"type": "url", | ||
"id": "button_link", | ||
"label": "Button link" | ||
}, | ||
{ | ||
"type": "text", | ||
"id": "button_text", | ||
"label": "Button text", | ||
"default": "View All" | ||
} | ||
], | ||
"presets": [{ | ||
"name": "Top Products Slider" | ||
}] | ||
} | ||
{% endschema %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<svg width="100%" height="100%" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path d="M16.25 20.5834L8.6667 13L16.25 5.41673" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> | ||
</svg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<svg width="100%" height="100%" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path d="M9.75 5.41666L17.3333 13L9.75 20.5833" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> | ||
</svg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<svg width="100%" height="100%" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path d="M8 0L10.3982 4.69921L15.6085 5.52786L11.8803 9.26079L12.7023 14.4721L8 12.08L3.29772 14.4721L4.11969 9.26079L0.391548 5.52786L5.60184 4.69921L8 0Z" fill="currentColor"/> | ||
</svg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.