Skip to content

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

Fix home page grid

weronka5f16cfaae526
diff --git a/saleor/core/views.py b/saleor/core/views.py
index 3a4985a9fd..21aca8ec94 100644
--- a/saleor/core/views.py
+++ b/saleor/core/views.py
@@ -4,7 +4,7 @@ from ..product.utils import products_with_availability, products_with_details
def home(request):
- products = products_with_details(request.user)[:6]
+ products = products_with_details(request.user)[:8]
products = products_with_availability(
products, discounts=request.discounts, local_currency=request.currency)
return TemplateResponse(
diff --git a/saleor/static/scss/storefront/components/_home.scss b/saleor/static/scss/storefront/components/_home.scss
index 1de529e4f3..d87c68d89a 100644
--- a/saleor/static/scss/storefront/components/_home.scss
+++ b/saleor/static/scss/storefront/components/_home.scss
@@ -8,27 +8,53 @@
.btn {
margin-top: $global-margin;
}
+ &--content-wrapper {
+ display: table;
+ width: 100%;
+ height: 100%;
+ }
+ &--content-inner {
+ display: table-cell;
+ text-align: center;
+ vertical-align: middle;
+ color: white
+ }
+ &--content {
+ position: absolute;
+ top: 0;
+ left: 0;
+ bottom: 0;
+ right: 0;
+ }
+ &--square {
+ background-size: cover;
+ position: relative;
+ &:before {
+ content: "";
+ display: block;
+ padding-top: 100%;
+ }
+ }
&__block1 {
- div {
+ .home--square {
background-image: url('../../images/block1.jpg');
- padding: $global-padding * 15 0 $global-padding * 12;
- background-size: cover;
+ @include media-breakpoint-up(md) {
+ &:before {
+ padding-top: 50%;
+ }
+ }
}
}
&__block2 {
margin-top: $global-margin * 2;
- div {
+ .home--square {
background-image: url('../../images/block2.jpg');
- background-size: cover;
- padding: $global-padding * 10 $global-padding $global-padding * 8;
}
}
&__block3 {
margin-top: $global-margin * 2;
- div {
+ .home--square {
background-image: url('../../images/block3.jpg');
- background-size: cover;
- padding: $global-padding * 10 $global-padding $global-padding * 8;
}
}
&__featured {
diff --git a/templates/category/_items.html b/templates/category/_items.html
index 7d484acc45..9a19e599bb 100644
--- a/templates/category/_items.html
+++ b/templates/category/_items.html
@@ -4,7 +4,7 @@
{% load product_first_image from product_images %}
{% for product, availability in products %}
- <div class="col-xs-6 col-md-4 product-list" itemscope itemtype="https://schema.org/Product">
+ <div class="col-6 col-lg-3 product-list" itemscope itemtype="https://schema.org/Product">
<div class="text-center">
<div>
<a itemprop="url" href="{{ product.get_absolute_url }}">
diff --git a/templates/home.html b/templates/home.html
index 635dbdf67d..eb221cd5df 100644
--- a/templates/home.html
+++ b/templates/home.html
@@ -6,30 +6,48 @@
<div class="home">
<div class="row">
<div class="col-sm-12 home__block1">
- <div>
- <h1>{% trans "Promo &amp; Sale" %}</h1>
- <h2>{% trans "form the Northpole" %}</h2>
- <button class="btn btn-secondary home__button">
- {% trans "Shop now" %}
- </button>
+ <div class="home--square">
+ <div class="home--content">
+ <div class="home--content-wrapper">
+ <div class="home--content-inner">
+ <h1>{% trans "Promo &amp; Sale" %}</h1>
+ <h2>{% trans "form the Northpole" %}</h2>
+ <button class="btn btn-secondary home__button">
+ {% trans "Shop now" %}
+ </button>
+ </div>
+ </div>
+ </div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 col-md-6 home__block2">
- <div>
- <h1>{% trans "Size &amp; Colours" %}</h1>
- <button class="btn btn-secondary home__button">
- {% trans "Shop now" %}
- </button>
+ <div class="home--square">
+ <div class="home--content">
+ <div class="home--content-wrapper">
+ <div class="home--content-inner">
+ <h1>{% trans "Size &amp; Colours" %}</h1>
+ <button class="btn btn-secondary home__button">
+ {% trans "Shop now" %}
+ </button>
+ </div>
+ </div>
+ </div>
</div>
</div>
<div class="col-sm-12 col-md-6 home__block3">
- <div>
- <h1>{% trans "DIGITAL DWNLDS" %}</h1>
- <button class="btn btn-secondary home__button">
- {% trans "Shop now" %}
- </button>
+ <div class="home--square">
+ <div class="home--content">
+ <div class="home--content-wrapper">
+ <div class="home--content-inner">
+ <h1>{% trans "Digital Downloads" %}</h1>
+ <button class="btn btn-secondary home__button">
+ {% trans "Shop now" %}
+ </button>
+ </div>
+ </div>
+ </div>
</div>
</div>
</div>