Skip to content

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

Move search form to header bar

weronka1d5ec30779a0
diff --git a/saleor/static/scss/dashboard.scss b/saleor/static/scss/dashboard.scss
index 0e9395cdb2..8a0c213d2c 100644
--- a/saleor/static/scss/dashboard.scss
+++ b/saleor/static/scss/dashboard.scss
@@ -26,6 +26,51 @@ header {
.top-nav {
box-shadow: none;
line-height: 0;
+ .left {
+ width: 98vw;
+ @media (max-width: $small-screen) {
+ width: auto;
+ }
+ .search {
+ min-width: 50%;
+ width: auto;
+ .input-field {
+ margin-top: 0.5rem;
+ @media (min-width: $large-screen) {
+ margin-top: 0.3rem;
+ }
+ margin-left: 3rem;
+ input {
+ padding: 1rem;
+ background-color: $primary-color-light;
+ margin-bottom: 0;
+ border-radius: 3px;
+ width: 80%;
+ display: inline-block;
+ @media (min-width: $large-screen) {
+ width: 90%;
+ }
+ @media (max-width: $medium-screen) {
+ width: 70%;
+ }
+ &:focus {
+ background-color: white;
+ }
+ }
+ .search-icon {
+ background: transparent;
+ border: none;
+ position: absolute;
+ right: 0;
+ top: 0.5rem;
+ i {
+ height: 21px;
+ line-height: 1;
+ }
+ }
+ }
+ }
+ }
.user-name {
padding: (($dropdown-item-height - 22) / 2) 16px;
white-space: normal;
@@ -59,6 +104,7 @@ header {
line-height: $header-height/2;
position: relative;
top: $header-height/4;
+ margin-left: 1rem;
i {
height: $header-height/2;
line-height: $header-height/2;
diff --git a/templates/dashboard/base.html b/templates/dashboard/base.html
index b22f2a6144..7f1a6e94d9 100644
--- a/templates/dashboard/base.html
+++ b/templates/dashboard/base.html
@@ -29,6 +29,9 @@
<li><a href="{% url 'account_logout' %}" class="waves-effect waves-teal">{% trans "Log out" %}</a></li>
</ul>
<a class="dropdown-button" data-constrainwidth="false" href="#" data-activates="user-action"><i class="material-icons">account_circle</i><i class="mdi-navigation-arrow-drop-down right"></i></a>
+ {% if SEARCH_IS_ENABLED %}
+ <a href="{% url "dashboard:search" %}" class="hide-on-med-and-up dropdown-button"><i class="material-icons">search</i></a>
+ {% endif %}
</div>
<ul class="side-nav" id="main-nav">
<li class="nav-home"><a href="{% url 'dashboard:index' %}">{% trans "Home" %}</a></li>
@@ -66,12 +69,24 @@
</ul>
<ul>
<li class="menu-toggle">
- <ul>
+ <ul class="left">
<li><a href="#" id="open-menu" class="show-on-large"><i class="material-icons">menu</i></a></li>
<li><a href="#" id="close-menu" class="show-on-large hide"><i class="material-icons">clear</i></a></li>
<li><a href="{% url 'dashboard:index' %}" class="logo">
<img src="{% static "img/dashboard-logo.svg" %}" alt="Saleor">
</a></li>
+ <li class="search">
+ {% if SEARCH_IS_ENABLED %}
+ <form method="get" action="{% url "dashboard:search" %}" class="hide-on-small-only">
+ <div class="input-field">
+ <input id="search" type="search" class="validate" placeholder="Order, product, customer" name="q" value="{% if query %}{{ query }}{% endif %}">
+ <button type="submit" class="right search-icon">
+ <i class="material-icons">search</i>
+ </button>
+ </div>
+ </form>
+ {% endif %}
+ </li>
</ul>
</li>
</ul>
@@ -92,21 +107,6 @@
<main class="main">
<div class="container">
- {% if SEARCH_IS_ENABLED %}
- <div class="row">
- <form class="col s12" method="get" action="{% url "dashboard:search" %}">
- <div class="row">
- <div class="input-field col s6">
- <i class="material-icons prefix">search</i>
- <input id="icon_prefix" type="text" class="validate" placeholder="Order, product, customer" name="q" value="{% if query %}{{ query }}{% endif %}">
- </div>
- <button class="btn waves-effect waves-light" type="submit" style="margin-top: 1.75rem">Search
- <i class="material-icons right">search</i>
- </button>
- </div>
- </form>
- </div>
- {% endif %}
{% block content %}
{% endblock %}
</div>