diff --git a/assets/styles.css b/assets/styles.css index c52316317..f912bd997 100644 --- a/assets/styles.css +++ b/assets/styles.css @@ -25,7 +25,7 @@ body { margin: 25px 100px; float: right; border: 1px solid #d8d8d8; - padding: 10px 30px; + padding: 30px 30px; background-color: white; -webkit-box-shadow: 0px 2px 15px -12px rgba(0, 0, 0, 0.57); -moz-box-shadow: 0px 2px 15px -12px rgba(0, 0, 0, 0.57); @@ -89,7 +89,7 @@ li { } .out-of-stock-img { - opacity:0.5 + opacity: 0.5; } p { diff --git a/index.html b/index.html index 56c112638..e3e786f70 100644 --- a/index.html +++ b/index.html @@ -6,14 +6,41 @@ - +
-

Product goes here

+ + +
Cart({{ cart }})
+ +
+
+
+ +
+
+

{{ product }}

+

In Stock

+

Out of Stock

+
    +
  • {{ detail }}
  • +
+
{{ variant.color }}
+ + + + +
+
+
- + + + diff --git a/main.js b/main.js index aedc73d86..a41379d7a 100644 --- a/main.js +++ b/main.js @@ -1 +1,30 @@ -const product = 'Socks' +const app = Vue.createApp({ + data() { + return { + cart: 0, + product: 'Socks', + image: './assets/images/socks_blue.jpg', + inStock: true, + details: ['50% cotton', '30% wool', '20% polyester'], + variants: [ + { id: 2234, color: 'green', image: './assets/images/socks_green.jpg' }, + { id: 2235, color: 'blue', image: './assets/images/socks_blue.jpg' }, + ] + } + }, + methods: { + addToCart() { + this.cart += 1 + }, + // solution + removeFromCart() { + if (this.cart >= 1) { + this.cart -= 1 + } + }, + // solution + updateImage(variantImage) { + this.image = variantImage + } + } +})