summaryrefslogblamecommitdiff
path: root/iridescence/src/components/Navbar.vue
blob: 16415bbba0da8d6c3e4c5e6187784e82b7c002f5 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11

                   
                                                    


                                         




                                   








                                                                   





                                                       
              






                                                                     

















                                                             
                                   
                                         







                


                                                           

                 



                 











                                       

                  

                                                         
                


                              








                                             
<template>
  <div id="navbar">
    <nav class="navbar is-fixed-top is-transparent">
      <div class="navbar-brand">
        <div class="navbar-item">
          <img src="@/assets/logo.png" />
          <div class="navbar-item">
            <span>
              The Glassy Ladies
            </span>
          </div>
        </div>
        <a class="navbar-burger burger" v-on:click="toggleNavMenu">
          <span></span>
          <span></span>
          <span></span>
        </a>
      </div>
      <div :class="navMenu">
        <div class="navbar-start">
          <router-link to="/" class="navbar-item">
            Home
          </router-link>
          <router-link to="/about" class="navbar-item">
            About
          </router-link>
        </div>

        <div class="navbar-end" v-if="routeName == 'Administration'">
          <div class="navbar-item">
            <NewProduct></NewProduct>
          </div>
        </div>
        <div class="navbar-end" v-else>
          <div
            class="navbar-item has-dropdown is-active"
            v-for="category in categories.keys()"
            :key="category"
          >
            <div class="navbar-link">
              {{ category }}
            </div>

            <div
              class="navbar-dropdown"
              v-for="subcategory in categories.get(category)"
              :key="subcategory"
            >
              {{ subcategory }}
            </div>
          </div>

          <div class="navbar-item">
            <CartCheckout></CartCheckout>
          </div>
        </div>
      </div>
    </nav>
  </div>
</template>

<script>
import CartCheckout from "@/components/CartCheckout.vue";
import NewProduct from "@/components/admin/NewProduct.vue";

export default {
  name: "Navbar",
  components: {
    CartCheckout,
    NewProduct
  },
  data() {
    return {
      isMenuActive: false
    };
  },
  computed: {
    navMenu() {
      if (this.isMenuActive) {
        return "navbar-menu is-active";
      } else {
        return "navbar-menu";
      }
    },
    categories() {
      const products = this.$store.getters.products;
      console.log(products.map(item => item.categories));
      return [];
    },
    routeName() {
      return this.$route.name;
    }
  },
  methods: {
    toggleNavMenu() {
      this.isMenuActive = !this.isMenuActive;
    }
  }
};
</script>