Commit 5f15f8c1 authored by Shaphen's avatar Shaphen

[AFP-47 Shaphen Pangburn]: Show discount details on produc details modal

parent b49c9405
...@@ -29,6 +29,16 @@ export default class ProductDetails extends Component { ...@@ -29,6 +29,16 @@ export default class ProductDetails extends Component {
<p>Free Delivery: <span>Everywhere!</span></p> <p>Free Delivery: <span>Everywhere!</span></p>
<p>Get it by: <span>Never!</span></p> <p>Get it by: <span>Never!</span></p>
</div> </div>
{
this.props.product.promo ?
<div>
<p id="prod-details-promo-percentage">This is currently { this.props.product.promo }% off!</p>
<p id="prod-details-promo-discount-number">Buy now for ${ this.props.discount }</p>
<p id="prod-details-promo-original-price">Normally: ${ this.props.product.price }</p>
</div>
:
""
}
<input type="number" id="prod-details-quantity" placeholder="Quantity" /> <input type="number" id="prod-details-quantity" placeholder="Quantity" />
<button id="prod-details-add-to-cart"> <button id="prod-details-add-to-cart">
Add to Cart Add to Cart
......
...@@ -22,6 +22,7 @@ export default class ProductItem extends Component { ...@@ -22,6 +22,7 @@ export default class ProductItem extends Component {
} }
render() { render() {
let discount = this.calculateDiscount(this.props.item.price, this.props.item.promo)
return ( return (
<div className="product-item"> <div className="product-item">
<div id="more-details-img-box"> <div id="more-details-img-box">
...@@ -41,7 +42,7 @@ export default class ProductItem extends Component { ...@@ -41,7 +42,7 @@ export default class ProductItem extends Component {
${ this.props.item.price } ${ this.props.item.price }
</p> </p>
<p id="promo-show-text"> <p id="promo-show-text">
${ this.calculateDiscount(this.props.item.price, this.props.item.promo) } ${ discount }
</p> </p>
</div> : "$" + this.props.item.price } </div> : "$" + this.props.item.price }
</div> </div>
...@@ -79,7 +80,7 @@ export default class ProductItem extends Component { ...@@ -79,7 +80,7 @@ export default class ProductItem extends Component {
} }
}} }}
> >
<ProductDetails product={ this.props.item } /> <ProductDetails product={ this.props.item } discount={ discount } />
</Modal> </Modal>
</div> </div>
) )
......
...@@ -304,6 +304,20 @@ ...@@ -304,6 +304,20 @@
background-color: rgb(207, 205, 205); background-color: rgb(207, 205, 205);
} }
#prod-details-promo-percentage,
#prod-details-promo-discount-number {
font-size: 16px;
text-align: center;
color: green;
}
#prod-details-promo-original-price {
text-align: center;
font-size: 14px;
opacity: 0.7;
margin-bottom: 10px;
}
input::-webkit-outer-spin-button, input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button { input::-webkit-inner-spin-button {
-webkit-appearance: none; -webkit-appearance: none;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment