openfoodfoundation/openfoodnetwork

View on GitHub
app/webpacker/css/admin_v3/components/navigation.scss

Summary

Maintainability
Test Coverage
// Navigation
//---------------------------------------------------

@mixin menu-display {
  display: flex;
  flex-wrap: wrap;
}

@mixin menu-link {
  a {
    display: inline-block;
    padding: 16px 20px;
    color: $color-9 !important;
    text-align: center;
    position: relative;
    font-size: 14px;
    font-weight: 600;

    &:hover {
      color: $red !important;

      &:after {
        content: "";
        position: absolute;
        bottom: 0;
        left: 20px;
        right: 20px;
        height: 3px;
        background: $red;
      }
    }

    &.active {
      @extend :hover;
    }
  }
}

.inline-menu {
  margin: 0;
  -webkit-margin-before: 0;
  -webkit-padding-start: 0;
}

// tabs
/// use the same styling as #admin-menu via menu-display and menu-link mixins
dl.admin-tabs {
  box-shadow: $box-shadow;
  @include menu-display;

  dd {
    width: auto;
    padding: 0;
    @include menu-link;
  }
}

nav.menu {
  ul {
    list-style: none;

    li {
      a {
        padding: 10px 0;
        display: block;
        position: relative;
        text-align: left;
        border: 1px solid transparent;
        text-transform: uppercase;
        font-weight: 600;
        font-size: 16px;
      }

      &.active a {
        color: $red;
        border-left-width: 0;
        border-bottom-color: $red;
      }

      &:hover a {
        color: $red;
      }
    }
  }
}

.admin-login-navigation-bar {
  ul {
    text-align: right;

    li {
      padding: 5px 0 5px 10px;
      text-align: right;
      font-size: 90%;
      color: $color-link;
      margin-top: 8px;

      &.user-logged-in-as {
        width: 50%;
        color: $color-body-text;
      }

      &:hover {
        i {
          color: $red;
        }
      }
    }
  }
}

#admin-menu {
  box-shadow: $box-shadow;

  li {
    .dropdown {
      width: 300px;
      background-color: $teal;
      width: 200px;
      z-index: 100000;

      > li {
        width: 200px !important;

        a:after {
          display: none;
        }
      }
    }
  }
}

#sub-menu {
  padding-bottom: 0;
  box-shadow: 0px 1px 0px $color-7;
}

// Factorized rules on menu item for admin menu and sub menu
#admin-menu,
#sub-menu {
  .container {
    padding-left: 10px;
    padding-right: 10px;
  }

  ul {
    @include menu-display;

    li {
      @include menu-link;

      &.selected a {
        @extend a, :hover;
      }
    }
  }
}

// Specific rules on menu item for admin menu and sub menu
#admin-menu {
  ul {
    li a {
      font-size: 16px;
    }
  }
}

#sub-menu {
  ul li a:hover {
    &:after {
      height: 2px;
    }
  }
}

#header figure {
  margin: 0.25em 0;
}

#header .container {
  padding-left: 30px;
  padding-right: 30px;
}

#login-nav {
  line-height: 1.75em;
}