Skip to content

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

Fix header grid position styles

Krzysztof Białogłowiczde6a1e996638
diff --git a/saleor/static/images/search-icon.svg b/saleor/static/images/search-icon.svg
index 6eb08bceee..df628ae411 100755
--- a/saleor/static/images/search-icon.svg
+++ b/saleor/static/images/search-icon.svg
@@ -3,7 +3,7 @@
<desc>Created using Figma</desc>
<g id="Canvas" transform="translate(1882 1346)" figma:type="canvas">
<g id="&#239;&#128;&#130;" style="mix-blend-mode:normal;" figma:type="text">
-<use xlink:href="#path0_fill" transform="translate(-1882 -1349)" fill="#333333" style="mix-blend-mode:normal;"/>
+<use xlink:href="#path0_fill" transform="translate(-1882 -1349)" fill="#828282" style="mix-blend-mode:normal;"/>
</g>
</g>
<defs>
diff --git a/saleor/static/img/search-icon-black.svg b/saleor/static/img/search-icon-black.svg
new file mode 100755
index 0000000000..6eb08bceee
--- /dev/null
+++ b/saleor/static/img/search-icon-black.svg
@@ -0,0 +1,12 @@
+<svg width="42" height="42" viewBox="0 0 42 42" 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>&#239;&#128;&#130;</title>
+<desc>Created using Figma</desc>
+<g id="Canvas" transform="translate(1882 1346)" figma:type="canvas">
+<g id="&#239;&#128;&#130;" style="mix-blend-mode:normal;" figma:type="text">
+<use xlink:href="#path0_fill" transform="translate(-1882 -1349)" fill="#333333" style="mix-blend-mode:normal;"/>
+</g>
+</g>
+<defs>
+<path id="path0_fill" d="M 25.6138 28.8532C 27.8237 26.6434 28.9286 23.99 28.9286 20.8929C 28.9286 17.7958 27.8237 15.1507 25.6138 12.9576C 23.4208 10.7478 20.7757 9.64286 17.6786 9.64286C 14.5815 9.64286 11.928 10.7478 9.71819 12.9576C 7.52511 15.1507 6.42857 17.7958 6.42857 20.8929C 6.42857 23.99 7.52511 26.6434 9.71819 28.8532C 11.928 31.0463 14.5815 32.1429 17.6786 32.1429C 20.7757 32.1429 23.4208 31.0463 25.6138 28.8532ZM 41.7857 41.7857C 41.7857 42.6563 41.4676 43.4096 40.8315 44.0458C 40.1953 44.6819 39.442 45 38.5714 45C 37.6674 45 36.9141 44.6819 36.3114 44.0458L 27.6981 35.4576C 24.7014 37.5335 21.3616 38.5714 17.6786 38.5714C 15.2846 38.5714 12.9911 38.1111 10.798 37.1903C 8.62165 36.2528 6.73828 34.9972 5.14788 33.4236C 3.57422 31.8331 2.31864 29.9498 1.38114 27.7734C 0.460379 25.5804 0 23.2868 0 20.8929C 0 18.4989 0.460379 16.2137 1.38114 14.0374C 2.31864 11.8443 3.57422 9.96094 5.14788 8.38728C 6.73828 6.79688 8.62165 5.5413 10.798 4.62054C 12.9911 3.68304 15.2846 3.21429 17.6786 3.21429C 20.0725 3.21429 22.3577 3.68304 24.534 4.62054C 26.7271 5.5413 28.6105 6.79688 30.1842 8.38728C 31.7746 9.96094 33.0301 11.8443 33.9509 14.0374C 34.8884 16.2137 35.3571 18.4989 35.3571 20.8929C 35.3571 24.5759 34.3192 27.9157 32.2433 30.9124L 40.8566 39.5257C 41.476 40.1451 41.7857 40.8984 41.7857 41.7857Z"/>
+</defs>
+</svg>
diff --git a/saleor/static/js/storefront.js b/saleor/static/js/storefront.js
index 8653210892..c1aa835134 100644
--- a/saleor/static/js/storefront.js
+++ b/saleor/static/js/storefront.js
@@ -66,11 +66,13 @@ let $searchIcon = $('.mobile-search-icon');
let $closeSearchIcon = $('.mobile-close-search');
let $searchForm = $('.navbar__brand__search');
$searchIcon.click((e) => {
- $searchForm.animate({left: 0}, {duration: 500});
-});
+ $searchForm.animate({left: 0}, {duration: 500})
+ $searchForm.parent().addClass('static');
+})
$closeSearchIcon.click((e) => {
- $searchForm.animate({left: '-100vw'}, {duration: 500});
-});
+ $searchForm.animate({left: '-100vw'}, {duration: 500})
+ $searchForm.parent().removeClass('static');
+})
// Sticky footer
diff --git a/saleor/static/scss/storefront/components/_header.scss b/saleor/static/scss/storefront/components/_header.scss
index 283cf99666..c3823da798 100644
--- a/saleor/static/scss/storefront/components/_header.scss
+++ b/saleor/static/scss/storefront/components/_header.scss
@@ -2,16 +2,15 @@
padding: 0;
@include media-breakpoint-down(sm) {
img {
- max-height: 22px;
+ max-height: 30px;
}
}
&__login {
- background-color: $gray;
p {
padding: $global-padding/2 0;
font-size: 0.8rem;
margin-bottom: 0;
- color: $white;
+ color: $dark-gray;
line-height: 1.9rem;
}
ul {
@@ -22,14 +21,17 @@
padding: $global-padding/2;
line-height: 1.9rem;
a {
- color: $body-color;
- font-size: 0.8rem;
+ color: $dark-gray;
+ font-size: 0.7rem;
+ text-transform: uppercase;
}
}
}
}
&__brand {
- padding: $global-padding * 2 0;
+ background-color: $light-gray;
+ padding-top: $global-padding*2;
+ padding-bottom: $global-padding*2;
@include media-breakpoint-down(sm) {
position: fixed;
width: 100vw;
@@ -37,13 +39,14 @@
z-index: 4;
border-bottom: 1px solid $gray;
}
+ .static {
+ position: static;
+ }
&__cart {
+ padding-right: $global-padding;
@include media-breakpoint-up(md) {
line-height: 2.4rem;
}
- &__icon {
- margin-left: $global-margin;
- }
a {
color: $body-color;
position: relative;
@@ -62,12 +65,6 @@
height: 30px;
text-align: center;
line-height: 2;
- @include media-breakpoint-down(sm) {
- font-size: 0.8rem;
- width: 25px;
- height: 25px;
- line-height: 2.1;
- }
}
}
}
@@ -82,17 +79,22 @@
.mobile-close-search {
position: absolute;
top: 1.9rem;
- left: 0.5rem;
+ right: 2rem;
max-width: 22px;
cursor: pointer;
}
+ .mobile-search-icon {
+ padding-right: $global-padding;
+ }
.search-input {
width: 100%;
- border-color: $body-color;
+ border-color: $gray;
+ border-radius: 0;
+ padding-left: $global-padding*2.5;
}
.btn {
position: absolute;
- right: 0.5rem;
+ left: 0.5rem;
border: 0;
img {
max-height: 1.5rem;
@@ -102,16 +104,14 @@
display: block;
left: -100vw;
position: absolute;
- width: 90%;
- max-width: 90%;
+ max-width: 100%;
float: right;
top: -2rem;
- z-index: 4;
+ z-index: 5;
margin-top: 0;
- input {
- padding: $global-padding * 2 $global-padding * 2 $global-padding * 2 $global-padding * 4;
+ .search-input {
+ padding: $global-padding * 2 $global-padding * 2 $global-padding * 2 $global-padding * 3;
border: 0;
- min-width: 100vw;
}
i {
position: absolute;
@@ -119,41 +119,40 @@
}
.btn {
top: 1.9rem;
- right: 0;
+ left: 1rem;
}
}
}
}
&__menu {
- ul {
- border-bottom: 1px solid $gray;
- margin-bottom: $global-margin;
- display: block;
- &.no-border {
- border-bottom: 0;
- margin-bottom: 0;
- }
- @include media-breakpoint-down(sm) {
- border-bottom: 0;
- }
- &:after {
- content: "";
- width: 100%;
- display: inline-block;
- }
- .nav-item {
- width: 20%;
- font-weight: 700;
- display: inline-block;
+ .navigation {
+ ul {
+ border-bottom: 1px solid $gray;
+ margin-bottom: $global-margin;
+ display: block;
text-align: center;
- + .nav-item {
- margin-left: 0;
+ &.no-border {
+ border-bottom: 0;
+ margin-bottom: 0;
}
- a {
- color: $body-color;
- transition: 0.3s;
- &:hover {
- color: rgba($body-color, 0.6);
+ @include media-breakpoint-down(sm) {
+ border-bottom: 0;
+ }
+ .nav-item {
+ font-weight: 700;
+ display: inline;
+ + .nav-item {
+ margin-left: 0;
+ }
+ a {
+ color: $body-color;
+ transition: 0.3s;
+ text-transform: uppercase;
+ display: inline-block;
+ padding: $global-padding;
+ &:hover {
+ color: rgba($body-color, 0.6);
+ }
}
}
}
diff --git a/templates/base.html b/templates/base.html
index f664c96961..66ba617cf5 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -27,95 +27,92 @@
<body itemscope itemtype="http://schema.org/WebPage">
{% block header %}
<header class="navbar" role="navigation">
- <div class="navbar__login hidden-sm-down">
- <div class="container">
- <div class="row">
- <div class="col-6">
- <p class="text-left">{% trans "Test Saleor - a sample shop!" %}</p>
- </div>
- <div class="col-6">
- <ul class="float-right">
- {% if user.is_authenticated %}
- {% if user.is_staff %}
+ <div class="navbar__login hidden-sm-down">
+ <div class="container">
+ <div class="row">
+ <div class="col-6">
+ <p class="text-left">{% trans "Test Saleor - a sample shop!" %}</p>
+ </div>
+ <div class="col-6">
+ <ul class="float-right">
+ {% if user.is_authenticated %}
+ {% if user.is_staff %}
+ <li>
+ <a href="{% url "dashboard:index" %}" traget="_blank">{% trans "Dashboard" %}</a>
+ </li>
+ {% endif %}
+ <li>
+ <a href="{% url "profile:details" %}">{% trans "Your account" %}</a>
+ </li>
+ <li>
+ <a href="{% url "account_logout" %}">{% trans "Log out" %}</a>
+ </li>
+ {% else %}
+ <li>
+ <a href="{% url "account_signup" %}">{% trans "Register" %}</a>
+ </li>
<li>
- <a href="{% url "dashboard:index" %}" traget="_blank">{% trans "Dashboard" %}</a>
+ <a href="{% url "account_login" %}">{% trans "Log in" %}</a>
</li>
{% endif %}
- <li>
- <a href="{% url "profile:details" %}">{% trans "Your account" %}</a>
- </li>
- <li>
- <a href="{% url "account_logout" %}">{% trans "Log out" %}</a>
- </li>
- {% else %}
- <li>
- <a href="{% url "account_signup" %}">{% trans "Register" %}</a>
- </li>
- <li>
- <a href="{% url "account_login" %}">{% trans "Log in" %}</a>
- </li>
- {% endif %}
- </ul>
+ </ul>
+ </div>
</div>
</div>
</div>
- </div>
- <div class="navbar__brand">
- <div class="container">
- <div class="row">
- <div class="col-3">
- <img class="hidden-md-up navbar__brand__menu-toggle closed open" src="{% static "img/mobile-bar.svg" %}">
- <a href="/">
- <img src="{% static "img/saleor-logo-black.svg" %}" alt="Testeor - Saleor demo store" height="38">
- </a>
- </div>
- <div class="col-6">
- {% if SEARCH_IS_ENABLED %}
- <form class="form-inline navbar__brand__search" action="{% url "search:search" %}">
- <img class="mobile-close-search hidden-md-up" src="{% static "img/close-icon.svg" %}">
- <input class="form-control search-input" type="text" placeholder="Search" name="q" value="{% if query %}{{ query }}{% endif %}">
- <button class="btn btn-link" type="submit">
- <img src="{% static "img/search-icon.svg" %}">
- </button>
- </form>
- {% endif %}
- {% if SEARCH_IS_ENABLED %}
- <img class="hidden-md-up mobile-search-icon" src="{% static "img/search-icon.svg" %}">
- {% endif %}
- </div>
- <div class="col-3">
- <div class="navbar__brand__cart float-right">
- <a href="{% url "cart:index" %}">
- <span class="hidden-sm-down">{% trans "Your cart" %}</span>
- <img class="navbar__brand__cart__icon" src="{% static "img/cart.svg" %}" alt="Cart">
- <span class="badge {% if not cart_counter %}hidden-xs-up{% endif %}">{{ cart_counter }}</span>
+ <div class="navbar__brand">
+ <div class="container">
+ <div class="row no-gutters">
+ <div class="col-8 col-md-4">
+ <img class="hidden-md-up navbar__brand__menu-toggle closed open" src="{% static "img/mobile-bar.svg" %}">
+ <a href="/" class="float-right float-md-left">
+ <img src="{% static "img/saleor-logo-black.svg" %}" alt="Testeor - Saleor demo store" height="38">
</a>
- <div class="cart-dropdown hidden-md-down">
- {% include 'cart-dropdown.html' %}
+ </div>
+ <div class="col-2 col-md-4">
+ {% if SEARCH_IS_ENABLED %}
+ <img class="hidden-md-up mobile-search-icon float-right" src="{% static "img/search-icon-black.svg" %}">
+ {% endif %}
+ {% if SEARCH_IS_ENABLED %}
+ <form class="form-inline navbar__brand__search" action="{% url "search:search" %}">
+ <img class="mobile-close-search hidden-md-up" src="{% static "img/close-icon.svg" %}">
+ <input class="form-control search-input" type="text" name="q" value="{% if query %}{{ query }}{% endif %}">
+ <button class="btn btn-link" type="submit">
+ <img src="{% static "img/search-icon.svg" %}">
+ </button>
+ </form>
+ {% endif %}
+ </div>
+ <div class="col-2 col-md-4">
+ <div class="navbar__brand__cart float-right">
+ <a href="{% url "cart:index" %}">
+ <img class="navbar__brand__cart__icon" src="{% static "img/cart.svg" %}" alt="Cart">
+ <span class="badge {% if not cart_counter %}hidden-xs-up{% endif %}">{{ cart_counter }}</span>
+ </a>
+ <div class="cart-dropdown hidden-md-down">
+ {% include 'cart-dropdown.html' %}
+ </div>
</div>
</div>
</div>
</div>
</div>
- </div>
-
- <div class="navbar__menu">
- <div class="container">
- <nav class="navigation">
+ <div class="navbar__menu">
+ <div class="container">
+ <nav class="navigation">
{% url 'home' as home_url %}
<ul class="nav navbar-nav{% if request.get_full_path == home_url %} no-border{% endif %}" >
{% for category in categories %}
<li class="nav-item">
- <a class="nav-link" href="{{ category.get_absolute_url }}">
- {{ category }}
- </a>
+ <a class="nav-link" href="{{ category.get_absolute_url }}">
+ {{ category }}
+ </a>
</li>
{% endfor %}
</ul>
- </nav>
+ </nav>
+ </div>
</div>
- </div>
-
</header>
{% endblock %}
<div class="container maincontent">