Skip to content

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

Add empty state to cart

weronka46c0a0701f8b
diff --git a/saleor/static/img/pirate_cart.png b/saleor/static/img/pirate_cart.png
new file mode 100644
index 0000000000..f9252c0de2
Binary files /dev/null and b/saleor/static/img/pirate_cart.png differ
diff --git a/saleor/static/img/pirate_cart2x.png b/saleor/static/img/pirate_cart2x.png
new file mode 100644
index 0000000000..7df4c97146
Binary files /dev/null and b/saleor/static/img/pirate_cart2x.png differ
diff --git a/saleor/static/scss/demo/components/_cart.scss b/saleor/static/scss/demo/components/_cart.scss
index 05263a9993..869283f36c 100644
--- a/saleor/static/scss/demo/components/_cart.scss
+++ b/saleor/static/scss/demo/components/_cart.scss
@@ -40,4 +40,13 @@
margin-bottom: 0;
}
}
+ &__empty {
+ text-align: center;
+ img {
+ margin: $global-margin * 2 0;
+ }
+ .btn {
+ margin: $global-margin * 2 0 $global-margin * 5;
+ }
+ }
}
\ No newline at end of file
diff --git a/templates/demo/cart/index.html b/templates/demo/cart/index.html
index baf4bdc1d3..8d005e7fab 100644
--- a/templates/demo/cart/index.html
+++ b/templates/demo/cart/index.html
@@ -21,7 +21,7 @@
{% block content %}
<div class="cart">
{% if cart_lines %}
- <div class="cart__table-header">
+ <div class="cart__table-header hidden-sm-down">
<div class="row">
<div class="col-md-6">
<small>{% trans "Product" %}</small>
@@ -50,7 +50,7 @@
<h3>{{ line.variant.product }} - {{ line.variant.display_variant }}</h3>
</a>
</div>
- <div class="col-md-2 cart-item-amount">
+ <div class="col-md-2 col-xs-6 cart-item-amount">
<form role="form" action="{% url "cart:update-line" variant_id=line.variant.pk %}" method="post" class="form-cart">
<div class="input-group cart-item-quantity js-hidden{% if form.quantity.errors %} has-error{% endif %}">
{{ line.form.quantity }}
@@ -79,11 +79,11 @@
{% endfor %}
<div class="cart__total">
<div class="row">
- <div class="col-md-6">
+ <div class="col-xs-6">
<h3>{% trans "Subtotal" %}</h3>
<p>({% trans "Delivery claculated on checkout" %})</p>
</div>
- <div class="col-md-2 offset-md-2">
+ <div class="col-md-2 offset-md-2 col-xs-6">
<h3 class="cart-total" data-value="{% gross cart_total %}"{% if local_cart_total %} data-value-local="{% gross local_cart_total %}"{% endif %}>
{% spaceless %}
{% gross cart_total html=True %}
@@ -105,9 +105,11 @@
</div>
</div>
{% else %}
- <p>
- {% trans 'Your cart is empty' %}
- </p>
+ <div class="cart__empty">
+ <img src="{% static 'img/pirate_cart.png' %}" srcset="{% static 'img/pirate_cart.png' %} 1x, {% static 'img/pirate_cart2x.png' %} 2x">
+ <h2>{% trans "There are no products in your shopping cart." %}</h2>
+ <a href="/" class="btn primary">{% trans "Check out Our sales" %}</a>
+ </div>
{% endif %}
</div>
{% endblock content %}