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/components/ProductDetails.js b/components/ProductDetails.js
new file mode 100644
index 000000000..e6df085b5
--- /dev/null
+++ b/components/ProductDetails.js
@@ -0,0 +1,17 @@
+// solution
+app.component('product-details', {
+ props: {
+ details: {
+ type: Array,
+ required: true
+ }
+ },
+ template:
+ /*html*/
+ `
+
+ `
+})
+// solution
\ No newline at end of file
diff --git a/components/ProductDisplay.js b/components/ProductDisplay.js
new file mode 100644
index 000000000..0f028fd73
--- /dev/null
+++ b/components/ProductDisplay.js
@@ -0,0 +1,89 @@
+app.component('product-display', {
+ props: {
+ premium: {
+ type: Boolean,
+ required: true
+ }
+ },
+ template:
+ /*html*/
+ `
+
+
+
![]()
+
+
+
{{ title }}
+
In Stock
+
Out of Stock
+
Shipping: {{ shipping }}
+
+
+
+
+
+
+
+
+
+
`,
+ data() {
+ return {
+ product: 'Socks',
+ brand: 'Vue Mastery',
+ selectedVariant: 0,
+ details: ['50% cotton', '30% wool', '20% polyester'],
+ variants: [
+ { id: 2234, color: 'green', image: './assets/images/socks_green.jpg', quantity: 50 },
+ { id: 2235, color: 'blue', image: './assets/images/socks_blue.jpg', quantity: 0 },
+ ]
+ }
+ },
+ methods: {
+ addToCart() {
+ this.$emit('add-to-cart', this.variants[this.selectedVariant].id)
+ },
+ removeFromCart() {
+ this.$emit('remove-from-cart')
+ },
+ updateVariant(index) {
+ this.selectedVariant = index
+ }
+ },
+ computed: {
+ title() {
+ return this.brand + ' ' + this.product
+ },
+ image() {
+ return this.variants[this.selectedVariant].image
+ },
+ inStock() {
+ return this.variants[this.selectedVariant].quantity
+ },
+ shipping() {
+ if (this.premium) {
+ return 'Free'
+ }
+ return 2.99
+ }
+ }
+})
\ No newline at end of file
diff --git a/index.html b/index.html
index 56c112638..d81e39c8e 100644
--- a/index.html
+++ b/index.html
@@ -6,14 +6,24 @@
-
+
-
Product goes here
+
+
+
Cart({{ cart.length }})
+
-
+
+
+
+
+
+