summaryrefslogtreecommitdiff
path: root/iridescence/src/views/Cart.vue
blob: 26949f56a6e433d6b3c2183f5a904a9b5f580f94 (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
39
40
41
42
43
44
45
46
47
48
<template>
  <div id="cart">
    <div class="container">
      <div v-if="items.length" class="section">
        <div class="columns">
          <div class="column is-one-third">
            <Totals></Totals>
          </div>
          <div class="column">
            <h1 class="subtitle">Your Shopping Cart</h1>
            <CartItem
              v-for="item in items"
              :key="item[0]"
              v-bind:id="item[0] * 1"
              v-bind:in-cart="item[1]"
            ></CartItem>
          </div>
        </div>
      </div>
      <div v-else class="section">
        <div class="content">
          <p class="has-text-centered">
            There's nothing in your cart.
            <a> <router-link to="/">Start shopping!</router-link></a>
          </p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import CartItem from "@/components/cart/CartItem.vue";
import Totals from "@/components/cart/Totals.vue";

export default {
  name: "Cart",
  computed: {
    items() {
      return Object.entries(this.$store.state.cart);
    }
  },
  components: {
    CartItem,
    Totals
  }
};
</script>