crowdAI/crowdai

View on GitHub
app/assets/stylesheets/_header.scss

Summary

Maintainability
Test Coverage
/* Header */

header {
  width: 100%;
  height: 80px;
  border-bottom: 1px solid $color-grey-10;
  @media screen and (max-width: 800px) {
    height: 60px;
  }
  .branding {
    float: left;
    margin-top: 26px;
    @media screen and (max-width: 800px) {
      margin-top: 21px;
    }
    @media screen and (max-width: 640px) {
      margin-top: 16px;
    }
  }
  .search {
    float: left;
    margin: 21px 0 0 24px;
    @media screen and (max-width: 800px) {
      margin: 12px 0 0 20px;
    }
    @media screen and (max-width: 640px) {
      margin: 20px 0 0 0;
    }
  }

  .search {
    @media screen and (max-width: 640px) {
      margin: 20px 0 0 0;
      #search-box {
        display: none;
      }
      a.search-open {
        float: left;
        margin: 0 0 0 16px;
        width: 20px;
        color: $color-grey-40;
        font-family: 'FontAwesome';
        line-height: normal;
        &:hover {
          color: $color-grey-54;
        }
      }
    }
    a.search-open {
      @media screen and (min-width: 641px) {
        display: none;
      }
    }
  }
  #mobile-search-overlay {
    overflow: hidden;
    position: absolute;
    display: flex;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 640px;
    height: 0px;
    background: #fff;
    opacity: 0;
    transition: opacity 0.3s ease;
    a {
      float: left;
      font-family: 'FontAwesome';
      line-height: normal;
      color: $color-grey-40;

      &:hover {
        color: $color-grey-54;
      }
      &.search-open {
        margin: 20px 0 0 24px;
      }
      &#search-close {
        float: right;
        margin: 20px 12px 0 0;
      }
    }
    form {
      display: inherit;
      float: left;
      margin: 0 20px 0;
      width: 100%;
      min-width: 200px;

      input[type=search] {
        padding: 0;
        width: 100%;
        height: 59px;
        background: #fff;
        border: none;
        font-family: 'Roboto', sans-serif;
        font-size: 15px;
        text-align: left;
        -webkit-appearance: textfield;

        &:focus {
          outline: 0;
        }
        &::placeholder,
        &::-webkit-input-placeholder,
        &:-moz-placeholder,
        &::-moz-placeholder,
        &:-ms-input-placeholder {
          opacity: 0;
        }
        &:focus::placeholder,
        &:focus::-webkit-input-placeholder,
        &:focus:-moz-placeholder,
        &:focus::-moz-placeholder,
        &:focus:-ms-input-placeholder {
          opacity: 1;
        }
      }
      input::-webkit-search-decoration,
      input::-webkit-search-cancel-button {
        display: none;
      }
    }
    &.open {
      height: 59px;
      opacity: 1;
    }
    @media screen and (min-width: 641px) {
      display: none;
    }
  }
  nav {
    &.mobile-primary {
      @media screen and (max-width: 900px) {
        overflow: auto;
        position: absolute;
        top: 0;
        z-index: 200;
        width: 100%;
        height: 0;
        opacity: 0;
        background: #fff;
        transition: height 0.3s ease, opacity 0.2s ease;
        #mobile-nav-header {
          overflow: hidden;
          display: block;
          height: 80px;
          width: 100%;
          border-bottom: 1px solid $color-grey-10;
          a {
            &.logo {
              float: left;
              display: block;
              background: asset-url('misc/crowdai-logo.svg') no-repeat left center;
              width: 129px;
              height: 24px;
              margin-top: 17px;
            }
            &#mobile-nav {
              float: right;
              margin: 33px 0 0 0;
              @media screen and (max-width: 800px) {
                margin: 23px 0 0 0;
              }
            }
          }
          @media screen and (max-width: 800px) {
            height: 60px;
          }
        }
        ul {
          padding: 20px 0;
          border-bottom: 1px solid $color-grey-10;
          li {
            padding: 10px 48px;

            @media screen and (max-width: 1024px) {
              padding: 10px 40px;
            }
            @media screen and (max-width: 768px) {
              padding: 10px 32px;
            }
            @media screen and (max-width: 640px) {
              padding: 10px 24px;
            }
            @media screen and (max-width: 480px) {
              padding: 10px 16px;
            }
            @media screen and (max-width: 400px) {
              padding: 10px 12px;
            }
            a {
              border-bottom: 1px solid transparent;
              color: $color-accent-dark;
              &:hover {
                border-bottom: 1px solid $color-accent;
              }
            }
          }
          &:last-of-type {
            border-bottom: none;
            li {
              padding: 6px 48px;

            @media screen and (max-width: 1024px) {
              padding: 6px 40px;
            }
            @media screen and (max-width: 768px) {
              padding: 6px 32px;
            }
            @media screen and (max-width: 640px) {
              padding: 6px 24px;
            }
            @media screen and (max-width: 480px) {
              padding: 6px 16px;
            }
            @media screen and (max-width: 400px) {
              padding: 6px 12px;
            }
              a {
                border-bottom: 1px solid transparent;
                color: $color-grey-87;

                &:hover {
                  border-bottom: 1px solid $color-grey-87;
                }
              }
            }
          }
        }
      }
      @media screen and (min-width: 901px) {
          display: none;
      }
    }
    &.open {
      height: 100%;
      opacity: 1;
    }
  }
  nav.primary {
    float: right;
    line-height: 79px;
    @media screen and (max-width: 900px) {
      display: none;
    }
    li {
      float: left;
      color: $color-grey-87;
      margin-right: 24px;
      @media screen and (max-width: 1024px) {
        margin-right: 20px;
      }
      a {
        color: $color-grey-87;
        transition: .3s;
        &:hover {
          color: $color-accent-dark;
        }
      }
    }
    li:last-of-type {
      margin-right: 0;
    }
    .active {
      color: $color-accent-dark;
      border-bottom: 1px solid $color-accent;
    }
  }
  .menu {
    display: none;
    float: right;
    line-height: 80px;
    @media screen and (max-width: 900px) {
      display: block;
    }
    @media screen and (max-width: 800px) {
      line-height: 60px;
    }
  }
  .notifications {
    float: right;
    height: 80px;
    line-height: 80px;
    margin-left: 24px;
    @media screen and (max-width: 1024px) {
      margin-left: 20px;
    }
    @media screen and (max-width: 900px) {
      display: none;
    }
    .active {
      color: $color-accent;
      transition: 0.25s;
    }
    .active:hover {
      color: $color-accent-dark;
    }
  }
  .user {
    float: right;
    margin: 21px 0 0 24px;
    @media screen and (max-width: 1024px) {
      margin-left: 20px;
    }
    @media screen and (max-width: 900px) {
      display: none;
    }
    img {
      border-radius: 2px;
      width: 36px;
      height: 36px;
    }
  }
}