Ecommerce Header

By Kevin

F6
#
How do I use This?

Header for an eCommerce site that shows main and secondary navigation, including search and product category drop down.

HTML
<!-- NOTE: This is the off-canvas menu that appears when you click on the hamburger menu on smaller screens. Everything in the `.off-canvas` div belongs in `src/layouts/default.html`. Copy this section into the `default.html` file and remove it from this file.  -->
<div class="off-canvas ecommerce-header-off-canvas position-left" id="ecommerce-header" data-off-canvas>

  <!-- Close button -->
  <button class="close-button" aria-label="Close menu" type="button" data-close>
    <span aria-hidden="true">&times;</span>
  </button>

  <ul class="vertical menu">
    <li class="main-nav-link"><a href="categories.html">Category 1</a></li>
    <li class="main-nav-link"><a href="#">Category 2</a></li>
    <li class="main-nav-link"><a href="why.html">Category 3</a></li>
    <li class="main-nav-link"><a href="build.html">Category 4</a></li>
    <li class="main-nav-link"><a href="#">Category 5</a></li>
  </ul>

  <hr>

  <!-- Menu -->
  <ul class="menu vertical">
    <li><a href="#">Help</a></li>
    <li><a href="#">Order Status</a></li>
    <li><a href="#">Contact</a></li>
    <li><a href="#">My Account</a></li>
  </ul>

</div>

<!-- NOTE: This is the header menu that appears at the top of your site. -->
<div class="off-canvas-content" data-off-canvas-content>
  <div class="ecommerce-header-top show-for-large">
    <div class="row align-justify">
      <div class="ecommerce-header-top-message">
        Tagline Message Can Display Here
      </div>
      <div class="ecommerce-header-top-links">
        <ul>
          <li><a href="#">Help</a></li>
          <li><a href="#">Order Status</a></li>
          <li><a href="#">Contact</a></li>
          <li><a href="#">My Account</a></li>
          <li><a href="#" target="_blank"><i class="fa fa-shopping-cart"></i></a></li>
        </ul>
      </div>
    </div>
  </div>

  <div class="ecommerce-header show-for-large">
    <div class="row align-justify align-middle">
      <div class="shrink column">
        <ul class="vertical medium-horizontal menu">
          <li><a href="#"><img class="logo" src="https://placehold.it/160x50"></a></li>
          <li class="main-nav-link"><a href="categories.html">Category 1</a></li>
          <li class="main-nav-link"><a href="#">Category 2</a></li>
          <li class="main-nav-link"><a href="why.html">Category 3</a></li>
          <li class="main-nav-link"><a href="build.html">Category 4</a></li>
          <li class="main-nav-link"><a href="#">Category 5</a></li>
        </ul>
      </div>
      <div class="shrink column">
        <ul class="menu">
          <li><input type="search" placeholder="Search"></li>
          <li><button type="button" class="button search-button"></button></li>
        </ul>
      </div>
    </div>
  </div>

  <div class="ecommerce-header-mobile hide-for-large">
    <div class="ecommerce-header-mobile-left">
      <button class="menu-icon" type="button" data-toggle="ecommerce-header"></button>
      <form class="ecommerce-header-search-exandable">
        <input type="search" placeholder="Search">
      </form>
    </div>
    <div class="ecommerce-header-mobile-center">
      <a href="#"><img class="logo" src="https://placehold.it/130x30"></a>
    </div>
    <div class="ecommerce-header-mobile-right">
      <i class="fa fa-shopping-cart"></i>
    </div>
  </div>
</div>

.ecommerce-header {
  width: 100%;
  background-color: $white;

  .logo {
    height: 50px;
    width: 160px;
  }

  ul {
    background-color: $white;
  }

  li {
    display: inline-block;
  }

  .nav-links {
    margin-left: 15px;
  }

  a {
    color: $dark-gray;
    transition: color 0.5s ease;
    display: block;
  }

  a:hover {
    color: darken($dark-gray, 50%);
    transition: color 0.5s ease;
  }

  input {
    margin-right: 0px;

    @include breakpoint(large down) {
      width: 150px;
    }
  }

  &.top-bar {
    padding-top: 0;
    padding-bottom: 0;
  }

  .button.search-button {
    width: 39px;
    height: 39px;
    background-size: 20px 20px;
    background-image: url("https://placehold.it/20x20");
    background-repeat: no-repeat;
    background-position: center center;
    padding-left: 0;
    padding-right: 0;
    border-radius: 0px;
  }

  .menu > .main-nav-link > a {
    padding: 1.5em 0.85em 1.9em 0.85em;
  }
}


.ecommerce-header-top {
  width: 100%;
  background-color: darken($dark-gray,20%);
  height: 40px;
  padding: 8px 20px 10px 20px;

  .fa {
    color: $white;
    font-size: 1.5rem;
  }
}

.ecommerce-header-top-message {
  color: lighten($dark-gray, 100%);
  float: left;
}

.ecommerce-header-top-links {
  color: lighten($dark-gray, 100%);

  ul li {
    display: inline;
    padding-left: 20px;
  }

  a {
    color: lighten($dark-gray, 50%);
    transition: color 0.5s ease;
  }

  a:hover {
    color: lighten($dark-gray, 100%);
    transition: color 0.5s ease;
  }
}

.ecommerce-header-off-canvas {
  background-color: darken($dark-gray,20%);

  .menu {
    padding: 1rem 0;
  }

  .menu a {
    color: $dark-gray;
  }
}

.ecommerce-header-mobile {
  background-color: darken($dark-gray,20%);
  display: flex;
  padding: rem-calc(10) rem-calc(20);
  align-items: center;
  justify-content: space-between;
}

.ecommerce-header-mobile-left,
.ecommerce-header-mobile-right,
.ecommerce-header-mobile-center {
  flex: 1 0 0;
}

.ecommerce-header-mobile-left {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.ecommerce-header-mobile-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ecommerce-header-mobile-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;

  .fa {
    color: $white;
    font-size: 1.5rem;
  }
}

.ecommerce-header-search-exandable input[type=search] {
  margin: 0 1rem;
  background: $light-gray url(https://static.tumblr.com/ftv85bp/MIXmud4tx/search-icon.png) no-repeat 9px center;
  border: solid 1px $medium-gray;
  padding: 9px 10px 9px 26px;
  width: 35px;
  border-radius: 5000px;
  transition: all 0.5s;
}

.ecommerce-header-search-exandable input[type=search]:focus {
  width: 120px;
  background-color: $white;
  border-color: $primary-color;
  box-shadow: 0 0 5px rgba($primary-color, 0.5);
}

.ecommerce-header-search-exandable input:-moz-placeholder {
  color: $dark-gray;
}

.ecommerce-header-search-exandable input::-webkit-input-placeholder {
  color: $dark-gray;
}

.ecommerce-header-search-exandable input[type=search]:hover {
  background-color: $white;
}


.ecommerce-header {
  width: 100%;
  background-color: #fefefe;
}

.ecommerce-header .logo {
  height: 50px;
  width: 160px;
}

.ecommerce-header ul {
  background-color: #fefefe;
}

.ecommerce-header li {
  display: inline-block;
}

.ecommerce-header .nav-links {
  margin-left: 15px;
}

.ecommerce-header a {
  color: #8a8a8a;
  transition: color 0.5s ease;
  display: block;
}

.ecommerce-header a:hover {
  color: #0b0b0b;
  transition: color 0.5s ease;
}

.ecommerce-header input {
  margin-right: 0px;
}

@media screen and (max-width: 74.9375em) {
  .ecommerce-header input {
    width: 150px;
  }
}

.ecommerce-header.top-bar {
  padding-top: 0;
  padding-bottom: 0;
}

.ecommerce-header .button.search-button {
  width: 39px;
  height: 39px;
  background-size: 20px 20px;
  background-image: url("https://placehold.it/20x20");
  background-repeat: no-repeat;
  background-position: center center;
  padding-left: 0;
  padding-right: 0;
  border-radius: 0px;
}

.ecommerce-header .menu > .main-nav-link > a {
  padding: 1.5em 0.85em 1.9em 0.85em;
}

.ecommerce-header-top {
  width: 100%;
  background-color: #575757;
  height: 40px;
  padding: 8px 20px 10px 20px;
}

.ecommerce-header-top .fa {
  color: #fefefe;
  font-size: 1.5rem;
}

.ecommerce-header-top-message {
  color: white;
  float: left;
}

.ecommerce-header-top-links {
  color: white;
}

.ecommerce-header-top-links ul li {
  display: inline;
  padding-left: 20px;
}

.ecommerce-header-top-links a {
  color: white;
  transition: color 0.5s ease;
}

.ecommerce-header-top-links a:hover {
  color: white;
  transition: color 0.5s ease;
}

.ecommerce-header-off-canvas {
  background-color: #575757;
}

.ecommerce-header-off-canvas .menu {
  padding: 1rem 0;
}

.ecommerce-header-off-canvas .menu a {
  color: #8a8a8a;
}

.ecommerce-header-mobile {
  background-color: #575757;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  padding: 0.625rem 1.25rem;
  -webkit-align-items: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-justify-content: space-between;
      -ms-flex-pack: justify;
          justify-content: space-between;
}

.ecommerce-header-mobile-left,
.ecommerce-header-mobile-right,
.ecommerce-header-mobile-center {
  -webkit-flex: 1 0 0;
      -ms-flex: 1 0 0px;
          flex: 1 0 0;
}

.ecommerce-header-mobile-left {
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-align-items: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-justify-content: flex-start;
      -ms-flex-pack: start;
          justify-content: flex-start;
}

.ecommerce-header-mobile-center {
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-align-items: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-justify-content: center;
      -ms-flex-pack: center;
          justify-content: center;
}

.ecommerce-header-mobile-right {
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-align-items: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-justify-content: flex-end;
      -ms-flex-pack: end;
          justify-content: flex-end;
}

.ecommerce-header-mobile-right .fa {
  color: #fefefe;
  font-size: 1.5rem;
}

.ecommerce-header-search-exandable input[type=search] {
  margin: 0 1rem;
  background: #e6e6e6 url(https://static.tumblr.com/ftv85bp/MIXmud4tx/search-icon.png) no-repeat 9px center;
  border: solid 1px #cacaca;
  padding: 9px 10px 9px 26px;
  width: 35px;
  border-radius: 5000px;
  transition: all 0.5s;
}

.ecommerce-header-search-exandable input[type=search]:focus {
  width: 120px;
  background-color: #fefefe;
  border-color: #1779ba;
  box-shadow: 0 0 5px rgba(23, 121, 186, 0.5);
}

.ecommerce-header-search-exandable input:-moz-placeholder {
  color: #8a8a8a;
}

.ecommerce-header-search-exandable input::-webkit-input-placeholder {
  color: #8a8a8a;
}

.ecommerce-header-search-exandable input[type=search]:hover {
  background-color: #fefefe;
}

JS