<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" type="text/css" href="./assets/css/style.css">
  <title>Product app</title>
</head>
<body>
  <div class="nav-bar"></div>
  <div id="app">
    <div class="product">
      <div class="product-image">
        <a :href="link">
          <!-- bind the src attribute to the "image" property -->
          <img
            v-bind:src="image"
            :alt="description" :title="description"
          /><!-- :attr is shortcut for v-bind:attr -->
        </a>
      </div>
      <div class="product-info">
        <h1 v-cloak>{{ product }}</h1>

        <h2>Available?</h2>
        <p v-cloak v-show="inventory > 10">In stock</p>
        <p v-cloak v-show="inventory <= 10 && inventory > 0">Limited stock</p>
        <p v-cloak v-show="inventory <= 0" :class="{ false: inventory <= 0 }">Out of stock</p>
        <p v-if="onSale">On sale! Act fast.</p>

        <h2>Details</h2>
        <ul>
          <li v-for="detail in details">{{ detail }}</li>
        </ul>

        <h2>Colors</h2>
        <ul>
          <li v-for="variant in variants"
              v-bind:key="variant.variantId"
              @mouseover="updateImage(variant.variantImage)"
              class="color-box"
              :style="{ backgroundColor: variant.variantColor }"
          /><!-- @ est le raccourci de v-on: -->
        </ul>

        <h2>Sizes</h2>
        <ul>
          <li v-for="size in sizes" :key="size">{{ size }}</li>
        </ul>

        <button v-on:click="addToCart"
                :disabled="inventory <= 0"
                :class="{ disabledButton: !inventory }"
        >Add to cart</button>
        <button v-on:click="removeFromCart"
                :disabled="cart <= 0"
                :class="{ disabledButton: !cart }"
        >Remove</button>
        <div class="cart">
          <p>Cart({{cart}})</p>
        </div>
      </div>
    </div>
  </div>

  <script src="./assets/js/vue.js"></script>
  <script src="main.js"></script>
</body>
</html>
