summaryrefslogtreecommitdiff
path: root/iridescence/src/components/ProductDetail.vue
blob: 6725595c5ba7639895c44348baaca4c624bc4be0 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<template>
  <div id="productDetail">
    <div class="modal is-active">
      <div class="modal-background"></div>
      <div class="modal-content">
        <div class="card">
          <div class="card-image">
            <figure class="image ">
              <a target="_blank" :href="fullsize">
                <img :src="base" :alt="name" title="Click for fullsize" />
              </a>
            </figure>
          </div>

          <div class="card-content">
            <div class="content">
              <p class="title">
                {{ name }}
              </p>
              <p class="subtitle">
                {{ dollars }}
              </p>
              <p class="subtitle">{{ stock }}</p>
            </div>

            <div class="content">
              {{ description }}
            </div>
          </div>
        </div>
      </div>
      <div class="modal-close is-large"></div>
    </div>
  </div>
</template>

<script>
export default {
  name: "ProductDetail",
  props: {
    id: Number,
    name: String,
    quantity: Number,
    cents: Number,
    photo_base: String,
    photo_fullsize: String,
    description: String
  },
  computed: {
    stock() {
      if (this.quantity == 0) {
        return "Made to order";
      } else {
        return [this.quantity, "in stock"].join(" ");
      }
    },
    dollars() {
      return "$ " + (this.cents / 100).toFixed(2);
    },
    base() {
      return process.env.VUE_APP_IMAGE_ROOT + "/" + this.photo_base;
    },
    fullsize() {
      return process.env.VUE_APP_IMAGE_ROOT + "/" + this.photo_fullsize;
    }
  }
};
</script>