Skip to content

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

Fix sale label on category page

weronka41de316e65aa
diff --git a/saleor/static/images/sale_bg.svg b/saleor/static/images/sale_bg.svg
new file mode 100644
index 0000000000..dc40903746
--- /dev/null
+++ b/saleor/static/images/sale_bg.svg
@@ -0,0 +1,14 @@
+<svg width="49" height="49" viewBox="0 0 49 49" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:figma="http://www.figma.com/figma/ns">
+<title>Group</title>
+<desc>Created using Figma</desc>
+<g id="Canvas" transform="translate(-313 3408)" figma:type="canvas">
+<g id="Group" style="mix-blend-mode:normal;" figma:type="frame">
+<g id="Vector 2" style="mix-blend-mode:normal;" figma:type="vector">
+<use xlink:href="#path0_fill" transform="translate(313 -3408)" fill="#EB5757" style="mix-blend-mode:normal;"/>
+</g>
+</g>
+</g>
+<defs>
+<path id="path0_fill" d="M 0 48.5L 0 20L 20.5 0L 48.5 0L 0 48.5Z"/>
+</defs>
+</svg>
diff --git a/saleor/static/js/components/categoryPage/ProductPrice.js b/saleor/static/js/components/categoryPage/ProductPrice.js
index 051a43c4c8..7b6f37ea5f 100644
--- a/saleor/static/js/components/categoryPage/ProductPrice.js
+++ b/saleor/static/js/components/categoryPage/ProductPrice.js
@@ -1,6 +1,8 @@
import React, { PropTypes } from 'react';
import Relay from 'react-relay';
+import SaleImg from '../../../images/sale_bg.svg';
+
const ProductPrice = ({ availability, price }) => {
const { discount, priceRange } = availability;
const isPriceRange = priceRange && priceRange.minPrice.gross !== priceRange.maxPrice.gross;
@@ -11,7 +13,7 @@ const ProductPrice = ({ availability, price }) => {
{isPriceRange && <span>{gettext('from')} </span>} {gross}
</span>
{discount && (
- <div className="product-list__sale"><span>Sale</span></div>
+ <div className="product-list__sale"><img src={SaleImg}/><span>Sale</span></div>
)}
</div>
);
diff --git a/saleor/static/scss/storefront/components/_product-list.scss b/saleor/static/scss/storefront/components/_product-list.scss
index 6392877a34..80a85ff9e7 100644
--- a/saleor/static/scss/storefront/components/_product-list.scss
+++ b/saleor/static/scss/storefront/components/_product-list.scss
@@ -19,21 +19,20 @@
text-transform: uppercase;
}
&__sale {
- clip-path: polygon(0 37%, 37% 0, 100% 0, 0% 100%);
- background-color: $red;
- position: absolute;
- top: 0;
- left: 15px;
- width: 55px;
- height: 55px;
+ img {
+ position: absolute;
+ left: 0;
+ top: 0;
+ }
span {
position: absolute;
- top: 7px;
- left: 3px;
+ top: 0.5rem;
+ left: 0.15rem;
color: $white;
+ font-size: 0.8rem;
text-transform: uppercase;
transform: rotate(-45deg);
- font-weight: 700;
+ font-weight: 500;
}
}
}
diff --git a/templates/category/_items.html b/templates/category/_items.html
index 22e9fd51d2..ad57fc7dcf 100644
--- a/templates/category/_items.html
+++ b/templates/category/_items.html
@@ -17,7 +17,7 @@
{% price_range availability.price_range %}
{% if availability.discount %}
{% if undiscounted.min_price != price_range.min_price %}
- <div class="product-list__sale"><span>{% trans "Sale" %}</span></div>
+ <div class="product-list__sale"><img src="{% static "images/sale_bg.svg" %}"><span>{% trans "Sale" %}</span></div>
{% endif %}
{% endif %}
{% else %}