summaryrefslogblamecommitdiff
path: root/iridescence/src/components/CartCheckout.vue
blob: 590e5b97e7b99612840c1d7b2c2c2730dabd0ee4 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
          
                         

                                                                  
                                              




                                                             
          

           
 

                






                                                          


                                           






                          

     

         
<template>
  <div id="cartCheckout">
    <div class="buttons has-addons">
      <router-link to="/cart" class="button is-primary is-rounded"
        >🛒 {{ checkoutReady }}</router-link
      >
      <button class="button is-static">x{{ inCart }}</button>
      <button class="button is-static is-rounded">
        {{ cartTotal }}
      </button>
    </div>
  </div>
</template>

<script>
export default {
  name: "CartCheckout",
  computed: {
    inCart() {
      return Object.values(this.$store.state.cart).reduce(
        (acc, cur) => acc + cur,
        0
      );
    },
    cartTotal() {
      return this.$store.getters.cartTotal;
    },
    checkoutReady() {
      if (this.inCart) {
        return "Checkout";
      } else {
        return "";
      }
    }
  }
};
</script>