Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Update class to product-image and refactor to remove duplicated code

jxltom566076ad1007
diff --git a/saleor/static/scss/layouts/_product-list.scss b/saleor/static/scss/layouts/_product-list.scss
index d7f02de9a0..adc652f63e 100644
--- a/saleor/static/scss/layouts/_product-list.scss
+++ b/saleor/static/scss/layouts/_product-list.scss
@@ -11,16 +11,17 @@
}
}
+.product-image {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
.product-list {
text-align: center;
margin-bottom: $global-margin * 2;
- .img-wrapper {
- display: flex;
- align-items: center;
- justify-content: center;
- img {
- max-width: 100%;
- }
+ img {
+ max-width: 100%;
}
&-item-name {
margin: $global-margin / 2 0;
diff --git a/saleor/static/scss/layouts/_product-page.scss b/saleor/static/scss/layouts/_product-page.scss
index cdcd66d8d3..e49cf34db2 100644
--- a/saleor/static/scss/layouts/_product-page.scss
+++ b/saleor/static/scss/layouts/_product-page.scss
@@ -74,13 +74,8 @@
}
.carousel-item {
flex-flow: column;
- .img-wrapper {
- display: flex;
- align-items: center;
- justify-content: center;
- img {
- width: 100%;
- }
+ img {
+ width: 100%;
}
}
.carousel-indicators {
diff --git a/templates/product/_items.html b/templates/product/_items.html
index 79a5959995..7070b35b57 100644
--- a/templates/product/_items.html
+++ b/templates/product/_items.html
@@ -9,7 +9,7 @@
<a href="{{ product.get_absolute_url }}" class="link--clean">
<div class="text-center">
<div>
- <div class="img-wrapper" style="height: 255px;">
+ <div class="product-image" style="height: 255px;">
<img class="img-responsive lazyload lazypreload"
data-src="{% get_thumbnail product.get_first_image method="thumbnail" size=255 %}"
data-srcset="{% get_thumbnail product.get_first_image method="thumbnail" size=255 %} 1x, {% get_thumbnail product.get_first_image method="thumbnail" size=510 %} 2x"
diff --git a/templates/product/details.html b/templates/product/details.html
index 099d4261b6..5dae5ab7c2 100644
--- a/templates/product/details.html
+++ b/templates/product/details.html
@@ -73,7 +73,7 @@
<div class="carousel-inner" role="listbox">
{% for image in images %}
<div class="carousel-item{% if forloop.first %} active{% endif %}">
- <div class="img-wrapper" style="height: 540px;">
+ <div class="product-image" style="height: 540px;">
<img class="d-block img-fluid lazyload lazypreload"
data-src="{% get_thumbnail image.image method="thumbnail" size=540 %}"
data-srcset="{% get_thumbnail image.image method="thumbnail" size=540 %} 1x, {% get_thumbnail image.image method="thumbnail" size=1080 %} 2x"