UNCLASSIFIED - NO CUI

Skip to content
Snippets Groups Projects
NavBar.vue 10.6 KiB
Newer Older
graham.smith's avatar
graham.smith committed
<template>
luke.glasscock's avatar
luke.glasscock committed
  <div class="nav-bar-section">
graham.smith's avatar
graham.smith committed
    <v-app-bar
      id="app-bar"
      app
      dark
      height="102"
      :class="{
        'hide-nav-toolbar': showBurgerIcon,
        'search-expanded': isSearchExpanded,
      }"
    >
Graham Smith's avatar
Graham Smith committed
      <v-toolbar-title>
graham.smith's avatar
graham.smith committed
        <router-link to="/" class="d-flex" data-cy="nav-logo">
Deven Phillips's avatar
Deven Phillips committed
          <YodaLogo data-cy="v-img" id="p1-nav-logo" class="my-auto" />
Graham Smith's avatar
Graham Smith committed
        </router-link>
      </v-toolbar-title>
      <v-spacer></v-spacer>
graham.smith's avatar
graham.smith committed
      <v-toolbar-items>
        <div class="navbar-nav my-auto pr-10">
graham.smith's avatar
graham.smith committed
          <router-link class="nav-item" to="/" exact> Home </router-link>
luke.glasscock's avatar
luke.glasscock committed
          <v-menu open-on-hover bottom offset-y>
            <template v-slot:activator="{ on, attrs }">
graham.smith's avatar
graham.smith committed
              <span class="pt-1" v-bind="attrs" v-on="on">
luke.glasscock's avatar
luke.glasscock committed
                <router-link class="nav-item d-inline" to="/services">
graham.smith's avatar
graham.smith committed
                  Services
luke.glasscock's avatar
luke.glasscock committed
                  <v-icon class="navbar-chevron-icon">mdi-chevron-down</v-icon>
                </router-link>
              </span>
            </template>
            <v-list class="navbar-nav-list">
              <v-list-item
graham.smith's avatar
graham.smith committed
                v-for="(item, index) in servicesSubMenu"
luke.glasscock's avatar
luke.glasscock committed
                :key="index"
                :to="item.path"
                link
              >
graham.smith's avatar
graham.smith committed
                <v-list-item-title class="navbar-list-items">
                  {{ item.meta.breadcrumb }}
luke.glasscock's avatar
luke.glasscock committed
                </v-list-item-title>
              </v-list-item>
            </v-list>
          </v-menu>
Deven Phillips's avatar
Deven Phillips committed
          <router-link class="nav-item" to="/resellers">
graham.smith's avatar
graham.smith committed
            Resellers
Deven Phillips's avatar
Deven Phillips committed
          </router-link>
          <router-link class="nav-item" to="/resources">
graham.smith's avatar
graham.smith committed
            Resources
          </router-link>
Graham Smith's avatar
Graham Smith committed
          <router-link class="nav-item" to="/who-we-are">
graham.smith's avatar
graham.smith committed
            Who We Are
Graham Smith's avatar
Graham Smith committed
          </router-link>
          <router-link class="nav-item" to="/contact-us">
graham.smith's avatar
graham.smith committed
            Contact Us
Graham Smith's avatar
Graham Smith committed
          </router-link>
        </div>
      </v-toolbar-items>
luke.glasscock's avatar
luke.glasscock committed

graham.smith's avatar
graham.smith committed
      <Search
        @expanded="
          isSearchExpanded = true;
          menuVisible = false;
        "
        @collapsed="isSearchExpanded = false"
        :full-width="showBurgerIcon"
      />

Graham Smith's avatar
Graham Smith committed
      <v-app-bar-nav-icon
graham.smith's avatar
graham.smith committed
        id="nav-toggle"
Graham Smith's avatar
Graham Smith committed
        @click.stop="menuVisible = !menuVisible"
edgar.valles's avatar
edgar.valles committed
        class="mr-0"
graham.smith's avatar
graham.smith committed
        v-show="showBurgerIcon"
Graham Smith's avatar
Graham Smith committed
        <div class="burger burger-squeeze" :class="{ open: menuVisible }">
          <div class="burger-lines"></div>
        </div>
Graham Smith's avatar
Graham Smith committed
      </v-app-bar-nav-icon>
    </v-app-bar>
graham.smith's avatar
graham.smith committed

Graham Smith's avatar
Graham Smith committed
    <v-navigation-drawer
      v-model="menuVisible"
      :permanent="menuVisible"
      fixed
      disable-resize-watcher
      right
      bottom
      stateless
      temporary
      hide-overlay
      dark
      id="nav-drawer"
    >
      <div class="navbar-nav my-auto d-flex flex-column px-5">
        <router-link
luke.glasscock's avatar
luke.glasscock committed
          class="nav-item"
Graham Smith's avatar
Graham Smith committed
          to="/"
          exact
          @click.native="menuVisible = false"
        >
graham.smith's avatar
graham.smith committed
          Home
Graham Smith's avatar
Graham Smith committed
        </router-link>
luke.glasscock's avatar
luke.glasscock committed
        <v-divider class="my-2" />
Graham Smith's avatar
Graham Smith committed
        <router-link
luke.glasscock's avatar
luke.glasscock committed
          class="nav-item"
Graham Smith's avatar
Graham Smith committed
          to="/services"
          @click.native="menuVisible = false"
        >
graham.smith's avatar
graham.smith committed
          Services
Graham Smith's avatar
Graham Smith committed
        </router-link>
Graham Smith's avatar
Graham Smith committed
        <router-link
graham.smith's avatar
graham.smith committed
          v-for="item in servicesSubMenu"
          :key="item.path"
luke.glasscock's avatar
luke.glasscock committed
          :to="item.path"
          @click.native="menuVisible = false"
          class="nav-item-mobile"
        >
graham.smith's avatar
graham.smith committed
          {{ item.meta.breadcrumb }}
luke.glasscock's avatar
luke.glasscock committed
        </router-link>
luke.glasscock's avatar
luke.glasscock committed
        <v-divider class="mt-6 mb-2" />
Deven Phillips's avatar
Deven Phillips committed
        <router-link
          class="nav-item"
          to="/resellers"
          @click.native="menuVisible = false"
        >
          RESELLERS
        </router-link>

        <v-divider class="my-2" />

        <router-link
          class="nav-item"
          to="/resources"
          @click.native="menuVisible = false"
        >
graham.smith's avatar
graham.smith committed
          Resources
        </router-link>

        <v-divider class="my-2" />
luke.glasscock's avatar
luke.glasscock committed
        <router-link
          class="nav-item"
Graham Smith's avatar
Graham Smith committed
          to="/who-we-are"
          @click.native="menuVisible = false"
        >
graham.smith's avatar
graham.smith committed
          Who We Are
Graham Smith's avatar
Graham Smith committed
        </router-link>
luke.glasscock's avatar
luke.glasscock committed
        <v-divider class="my-2" />
Graham Smith's avatar
Graham Smith committed
        <router-link
luke.glasscock's avatar
luke.glasscock committed
          class="nav-item"
Graham Smith's avatar
Graham Smith committed
          to="/contact-us"
          @click.native="menuVisible = false"
        >
graham.smith's avatar
graham.smith committed
          Contact Us
Graham Smith's avatar
Graham Smith committed
        </router-link>
edgar.valles's avatar
edgar.valles committed
        <v-divider class="mt-2 mb-4" />
Graham Smith's avatar
Graham Smith committed
      </div>
    </v-navigation-drawer>
  </div>
graham.smith's avatar
graham.smith committed
</template>
graham.smith's avatar
graham.smith committed
<script>
Graham Smith's avatar
Graham Smith committed
import YodaLogo from "@/assets/images/logos/Logo_P1_Yoda_Campfire-WH.svg";
graham.smith's avatar
graham.smith committed
import Search from "@/components/Search.vue";
graham.smith's avatar
graham.smith committed
import { routesByName } from "@/router/routes";
Graham Smith's avatar
Graham Smith committed

graham.smith's avatar
graham.smith committed
export default {
  name: "NavBar",
  components: {
graham.smith's avatar
graham.smith committed
    Search,
luke.glasscock's avatar
luke.glasscock committed
  },

  data: () => ({
    menuVisible: false,
graham.smith's avatar
graham.smith committed
    servicesSubMenu: [
      routesByName.IronBank,
      routesByName.PartyBus,
      routesByName.BigBang,
      routesByName.CNAP,
      routesByName.Cybersecurity,
luke.glasscock's avatar
luke.glasscock committed
    ],
graham.smith's avatar
graham.smith committed
    navigationDrawerBreakPoint: 1150,
    showBurgerIcon: false,
    isSearchExpanded: false,
luke.glasscock's avatar
luke.glasscock committed
  }),
edgar.valles's avatar
edgar.valles committed
  beforeDestroy() {
    if (typeof window === "undefined") return;
edgar.valles's avatar
edgar.valles committed
    window.removeEventListener("resize", this.onResize, { passive: true });
  },

  mounted() {
    this.onResize();

    window.addEventListener("resize", this.onResize, { passive: true });
  },
luke.glasscock's avatar
luke.glasscock committed
  methods: {
edgar.valles's avatar
edgar.valles committed
    onResize() {
graham.smith's avatar
graham.smith committed
      this.showBurgerIcon = window.innerWidth < this.navigationDrawerBreakPoint;
luke.glasscock's avatar
luke.glasscock committed
  },
  watch: {
    "$vuetify.breakpoint.width": function (value) {
luke.glasscock's avatar
luke.glasscock committed
      if (value >= this.navigationDrawerBreakPoint) {
        this.menuVisible = false;
      }
graham.smith's avatar
graham.smith committed
};
</script>
Graham Smith's avatar
Graham Smith committed
<style lang="scss">
#nav-drawer {
  margin-top: 102px;
luke.glasscock's avatar
luke.glasscock committed
  z-index: 9;
Graham Smith's avatar
Graham Smith committed
}
.v-navigation-drawer__content {
  background-color: $dark-bg-color !important;
}
luke.glasscock's avatar
luke.glasscock committed
.navbar-nav-list {
  background-color: $dark-bg-color !important;
}

.navbar-list-items {
  color: #ffffff;

  &:hover {
    color: $p1-dark-green !important;
  }
}

a.nav-item {
  color: #ffffff !important;
graham.smith's avatar
graham.smith committed
  text-transform: uppercase;
luke.glasscock's avatar
luke.glasscock committed
  &:hover,
  &:active {
    color: #bdc931 !important;
    i.navbar-chevron-icon:not(.no-link) {
      color: #bdc931 !important;
    }
  }

  i.navbar-chevron-icon:not(.no-link) {
    padding: 0 0 4px 0;
    color: #ffffff !important;
  }
}

a.nav-item.router-link-active {
  color: #bdc931 !important;

  i.navbar-chevron-icon:not(.no-link) {
    padding: 0 0 4px 0;
    color: #bdc931 !important;
  }
}

Graham Smith's avatar
Graham Smith committed
.navbar-nav {
  font-weight: 600;
graham.smith's avatar
graham.smith committed

Graham Smith's avatar
Graham Smith committed
  .nav-item {
graham.smith's avatar
graham.smith committed
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease-out, visibility 0.25s ease-out;
Graham Smith's avatar
Graham Smith committed
    padding: 0.5rem;
    margin: 0 0.5rem;
    color: $light-text-color !important;
    letter-spacing: 0.02rem;
    border-top: 2px solid transparent;
    border-bottom: 2px solid transparent;
graham.smith's avatar
graham.smith committed

Graham Smith's avatar
Graham Smith committed
    &:hover {
      color: $p1-dark-green !important;
graham.smith's avatar
graham.smith committed
    }
  }
Graham Smith's avatar
Graham Smith committed
  .router-link-active {
    border-bottom: 2px solid $p1-light-green;
    color: $p1-light-green !important;
graham.smith's avatar
graham.smith committed
  }
luke.glasscock's avatar
luke.glasscock committed
// Mobile-view styling
.nav-item-mobile {
  padding: 0;
  margin: 0;
  font-size: 0.75rem !important;
  color: $light-text-color !important;
  letter-spacing: 0.04rem;
  border-top: 1px solid transparent;
  border-bottom: 1px solid transparent;
  &:hover {
    color: $p1-dark-green !important;
  }
}
graham.smith's avatar
graham.smith committed

Graham Smith's avatar
Graham Smith committed
#app-bar .navbar-nav .nav-item:last-child {
  margin-right: 0;
}
graham.smith's avatar
graham.smith committed

Graham Smith's avatar
Graham Smith committed
#app-bar {
  background-color: $dark-bg-color !important;
  padding-left: 1rem;
  padding-right: 1rem;
luke.glasscock's avatar
luke.glasscock committed
  z-index: 10;
graham.smith's avatar
graham.smith committed

graham.smith's avatar
graham.smith committed
  &.search-expanded {
    .nav-item {
      visibility: hidden;
      opacity: 0;
      transition: opacity 0.25s ease-out, visibility 0.25s ease-out;
    }
  }

  &.hide-nav-toolbar {
    .navbar-nav {
      display: none;
    }
    &.search-expanded {
      #p1-nav-logo,
      #nav-toggle {
        visibility: hidden;
        opacity: 0;
        transition: opacity 0.25s ease-out, visibility 0.25s ease-out;
      }
    }
  }

Graham Smith's avatar
Graham Smith committed
  #p1-nav-logo {
    width: 245px;
graham.smith's avatar
graham.smith committed
    min-width: 245px;
graham.smith's avatar
graham.smith committed
  }

graham.smith's avatar
graham.smith committed
  #nav-toggle {
    box-shadow: none;
  }

Graham Smith's avatar
Graham Smith committed
  @include xs {
    #p1-nav-logo {
Graham Smith's avatar
Graham Smith committed
      width: 180px;
graham.smith's avatar
graham.smith committed
      min-width: 180px;
Graham Smith's avatar
Graham Smith committed

  @include lg {
    padding-left: 4rem;
    padding-right: 4rem;
Graham Smith's avatar
Graham Smith committed
  }
Graham Smith's avatar
Graham Smith committed
  @include xl {
    padding-left: 6rem;
    padding-right: 6rem;
graham.smith's avatar
graham.smith committed
  }
Graham Smith's avatar
Graham Smith committed

  // burger css from https://github.com/march08/animated-burgers/blob/master/packages/BurgerSqueeze/dist/styles.css
  .burger {
    font-size: 10px;
    height: 3em;
    width: 3em;
    position: relative;
    cursor: pointer;
    -webkit-transition: 0.2s all;
    -o-transition: 0.2s all;
    transition: 0.2s all;
    -webkit-tap-highlight-color: transparent;
  }
  .burger .burger-lines:after {
    left: 0;
    top: -1em;
  }
  .burger .burger-lines:before {
    left: 1em;
    top: 1em;
  }
  .burger:after {
    content: "";
    display: block;
    position: absolute;
    height: 150%;
    width: 150%;
    top: -25%;
    left: -25%;
  }
  .burger .burger-lines {
    top: 50%;
    margin-top: -0.125em;
  }
  .burger .burger-lines,
  .burger .burger-lines:after,
  .burger .burger-lines:before {
    pointer-events: none;
    display: block;
    content: "";
    width: 100%;
    border-radius: 0.25em;
    background-color: white;
    height: 0.25em;
    position: absolute;
    -webkit-transform: rotate(0);
    -ms-transform: rotate(0);
    transform: rotate(0);
  }
  .burger .burger-lines:after {
    left: 0;
    top: -1em;
  }
  .burger .burger-lines:before {
    left: 1em;
    top: 1em;
  }
  .burger.burger-squeeze .burger-lines,
  .burger.burger-squeeze .burger-lines:after,
  .burger.burger-squeeze .burger-lines:before {
    -webkit-transition: 0.2s top 0.2s, 0.1s left, 0.2s transform,
      0.4s background-color 0.2s;
    -o-transition: 0.2s top 0.2s, 0.1s left, 0.2s transform,
      0.4s background-color 0.2s;
    transition: 0.2s top 0.2s, 0.1s left, 0.2s transform,
      0.4s background-color 0.2s;
  }

  .burger.burger-squeeze .burger-lines:after,
  .burger.burger-squeeze .burger-lines:before {
    width: 2em;
  }

  .burger.burger-squeeze.open .burger-lines,
  .burger.burger-squeeze.open .burger-lines:after,
  .burger.burger-squeeze.open .burger-lines:before {
    -webkit-transition: 0.2s background-color, 0.2s top, 0.2s left,
      0.2s transform 0.15s;
    -o-transition: 0.2s background-color, 0.2s top, 0.2s left,
      0.2s transform 0.15s;
    transition: 0.2s background-color, 0.2s top, 0.2s left, 0.2s transform 0.15s;
  }

  .burger.burger-squeeze.open .burger-lines {
    background-color: transparent;
  }

  .burger.burger-squeeze.open .burger-lines:before,
  .burger.burger-squeeze.open .burger-lines:after {
    left: 0.5em;
    top: 0px;
  }

  .burger.burger-squeeze.open .burger-lines:before {
    -webkit-transform: rotate(-45deg);
    -ms-transform: rotate(-45deg);
    transform: rotate(-45deg);
  }

  .burger.burger-squeeze.open .burger-lines:after {
    -webkit-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    transform: rotate(45deg);
  }
graham.smith's avatar
graham.smith committed
}
</style>