summaryrefslogtreecommitdiff
path: root/iridescence/src/components/CartCheckout.vue
blob: 1b327b23c427bedece6d72c56ef20414bc547071 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<template>
  <div id="cartCheckout">
    <div class="buttons has-addons">
      <router-link
        v-if="inCart"
        to="/cart"
        class="button is-success is-rounded"
      >
        <span class="iconify-inline" data-icon="mdi-cart"></span>
        <span>Checkout</span></router-link
      >
      <a v-else class="button is-static is-rounded">
        <span class="iconify-inline" data-icon="mdi-cart"></span>
      </a>
      <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;
    }
  }
};
</script>