Skip to content

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

Add template to dropdown with cart preview

weronka090b88b9802b
diff --git a/saleor/static/scss/demo/components/_buttons.scss b/saleor/static/scss/demo/components/_buttons.scss
index 70c86f066f..bbc06cd47e 100644
--- a/saleor/static/scss/demo/components/_buttons.scss
+++ b/saleor/static/scss/demo/components/_buttons.scss
@@ -24,6 +24,8 @@
&.secondary {
border: 1px solid $gray;
padding: $global-padding $global-padding * 2;
+ font-size: $font-size-h5;
+ background-color: transparent;
&:hover {
border-color: $body-color;
color: $body-color;
diff --git a/saleor/static/scss/demo/components/_cart-dropdown.scss b/saleor/static/scss/demo/components/_cart-dropdown.scss
new file mode 100644
index 0000000000..86e6eb6f74
--- /dev/null
+++ b/saleor/static/scss/demo/components/_cart-dropdown.scss
@@ -0,0 +1,50 @@
+.cart-dropdown {
+ position: absolute;
+ width: 460px;
+ top: 0;
+ padding-top: 50px;
+ right: 15px;
+ z-index: 3;
+ display: none;
+ .container {
+ background-color: $light-gray;
+ padding-top: $global-padding * 2;
+ padding-bottom: $global-padding * 2;
+ box-shadow: 3px 3px 3px 0px rgba($gray, 0.75);
+ }
+ a {
+ color: $body-color;
+ &:hover {
+ text-decoration: none;
+ }
+ }
+ &__image {
+ float: left;
+ width: 60px;
+ height: 60px;
+ margin-right: $global-margin / 2;
+ }
+ &__delete {
+ margin-bottom: $global-margin;
+ display: block;
+ }
+ &__actions {
+ margin-top: $global-margin * 2;
+ }
+ &:before {
+ content: '';
+ display: block;
+ width: 15px;
+ height: 10px;
+ position: absolute;
+ top: 40px;
+ right: 25px;
+ background-color: $light-gray;
+ clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
+ }
+ &__empty {
+ img {
+ margin: $global-margin 0;
+ }
+ }
+}
\ No newline at end of file
diff --git a/saleor/static/scss/demo/components/_header.scss b/saleor/static/scss/demo/components/_header.scss
index 2cc7ab40cc..a938050cd8 100644
--- a/saleor/static/scss/demo/components/_header.scss
+++ b/saleor/static/scss/demo/components/_header.scss
@@ -22,20 +22,27 @@
}
&__brand {
padding: $global-padding * 2 0;
+ .container {
+ position: relative;
+ }
&__cart {
+ &:hover .cart-dropdown {
+ display: block;
+ }
@include media-breakpoint-up(md) {
margin-top: $global-margin / 2;
}
+ &__icon {
+ margin-left: $global-margin;
+ }
margin-right: 15px;
a {
color: $body-color;
position: relative;
+ z-index: 4;
&:hover {
text-decoration: none;
}
- img {
- margin-left: $global-margin;
- }
.badge {
position: absolute;
right: -15px;
diff --git a/saleor/static/scss/demo/components/_home.scss b/saleor/static/scss/demo/components/_home.scss
index 10fdf13e8c..0817c3d8ca 100644
--- a/saleor/static/scss/demo/components/_home.scss
+++ b/saleor/static/scss/demo/components/_home.scss
@@ -38,10 +38,10 @@
}
}
&__featured {
+ color: $body-color;
h3 {
text-transform: uppercase;
font-weight: 700;
- color: $body-color;
margin: $global-margin * 4 0 $global-margin * 2;
}
}
diff --git a/saleor/static/scss/demo/components/_login.scss b/saleor/static/scss/demo/components/_login.scss
index 441003f1a0..50c210ea44 100644
--- a/saleor/static/scss/demo/components/_login.scss
+++ b/saleor/static/scss/demo/components/_login.scss
@@ -2,8 +2,8 @@
margin: $global-margin * 3 0;
fieldset {
margin-bottom: $global-margin;
- h1 {
- margin-bottom: $global-margin;
+ h2 {
+ margin-bottom: $global-margin * 2;
}
}
p, a {
@@ -24,6 +24,7 @@
border-top: 0;
border-left: 1px solid $gray;
margin-top: 0;
+ padding-top: 0;
}
img {
margin: $global-margin 0;
diff --git a/saleor/static/scss/demo/storefront.scss b/saleor/static/scss/demo/storefront.scss
index 39a0a01710..8c4715c68b 100644
--- a/saleor/static/scss/demo/storefront.scss
+++ b/saleor/static/scss/demo/storefront.scss
@@ -11,4 +11,5 @@
@import "components/cart";
@import "components/userprofile";
@import "components/login";
-@import "components/product-list";
\ No newline at end of file
+@import "components/product-list";
+@import "components/cart-dropdown";
\ No newline at end of file
diff --git a/templates/demo/base.html b/templates/demo/base.html
index e9dafaf5eb..7c1956916a 100644
--- a/templates/demo/base.html
+++ b/templates/demo/base.html
@@ -51,13 +51,14 @@
<img src="{% static "img/testeor-logo.svg" %}" alt="Testeor - Saleor demo store">
</a>
<div class="float-xs-right">
- <img class="hidden-md-up " src="{% static "img/search-icon.svg" %}">
+ <img class="hidden-md-up" src="{% static "img/search-icon.svg" %}">
<div class="navbar__brand__cart float-xs-right">
<a href="{% url "cart:index" %}">
<span class="hidden-sm-down">{% trans "Your cart" %}</span>
- <img src="{% static "img/cart.svg" %}" alt="Cart">
- {% if cart_counter %}<span class="badge">{{ cart_counter }}</span>{% endif %}
+ <img class="navbar__brand__cart__icon" src="{% static "img/cart.svg" %}" alt="Cart">
+ {% if cart_counter %}<span class="badge">{{ cart_counter }}</span>{% endif %}
</a>
+ {% include 'cart-dropdown.html' %}
</div>
</div>
</div>
diff --git a/templates/demo/cart-dropdown.html b/templates/demo/cart-dropdown.html
new file mode 100644
index 0000000000..1ecda0c7fc
--- /dev/null
+++ b/templates/demo/cart-dropdown.html
@@ -0,0 +1,51 @@
+{% load i18n %}
+{% load staticfiles %}
+{% load gross from prices_i18n %}
+
+<div class="cart-dropdown hidden-md-down">
+ <div class="container">
+ <!--
+ <div class="row">
+ <div class="col-md-6">
+ <a href="/">
+ <img class="cart-dropdown__image" src="{% static 'images/product-image-placeholder-small.png' %}" alt="">
+ <h3>Jeans
+ <br><small>Blue, S<br>
+ x 3</small>
+ </h3>
+ </a>
+ </div>
+ <div class="col-md-6">
+ <div class="float-xs-right">
+ <a class="cart-dropdown__delete" href="/">
+ <img src="{% static "img/icon_delete.svg" %}">
+ </a>
+ <h3>$ 127</h3>
+ </div>
+ </div>
+ </div>
+ <hr>
+ <div class="row">
+ <div class="col-md-6">
+ <h3>{% trans "Subtotal" %}</h3>
+ </div>
+ <div class="col-md-6">
+ <h3 class="float-md-right"><strong>$ 127</strong></h3>
+ </div>
+ </div>
+ <div class="row cart-dropdown__actions">
+ <div class="col-md-6">
+ <a href="{% url "checkout:index" %}" class="btn primary">{% trans "Checkout" %}</a>
+ </div>
+ <div class="col-md-6">
+ <a href="{% url "cart:index" %}" class="btn secondary float-md-right">{% trans "Go to cart" %}</a>
+ </div>
+ </div>
+ -->
+ <div class="text-md-center cart-dropdown__empty">
+ <h3>{% trans "There are no products in your shopping cart." %}</h3>
+ <img src="{% static 'img/pirate_cart.png' %}" srcset="{% static 'img/pirate_cart.png' %} 1x, {% static 'img/pirate_cart2x.png' %} 2x">
+ <a href="/" class="btn primary">{% trans "Check out Our sales" %}</a>
+ </div>
+ </div>
+</div>