Commit 48298d13 authored by Shaphen Pangburn's avatar Shaphen Pangburn

[AFP-48 Shaphen Pangburn]: Disable Add to Cart button animations and display...

[AFP-48 Shaphen Pangburn]: Disable Add to Cart button animations and display out of Stock for products with no available stock
parent ded2d113
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import Checkout from './checkout'; import Checkout from './checkout.js';
const mSTP = state => ({ const mSTP = state => ({
...@@ -8,5 +8,4 @@ const mSTP = state => ({ ...@@ -8,5 +8,4 @@ const mSTP = state => ({
const mDTP = dispatch => ({ const mDTP = dispatch => ({
}); });
export default connect(mSTP, mDTP)(Checkout); export default connect(mSTP, mDTP)(Checkout);
\ No newline at end of file
...@@ -102,6 +102,7 @@ export default class ProductItem extends Component { ...@@ -102,6 +102,7 @@ export default class ProductItem extends Component {
{ this.props.user?.currentUser ? "" :<p id="please-log-in-notice">Log in to Add to Cart</p>} { this.props.user?.currentUser ? "" :<p id="please-log-in-notice">Log in to Add to Cart</p>}
<input <input
className="order-quantity" className="order-quantity"
id={ this.props.user?.currentUser ? "" : "disabled" }
type="number" type="number"
placeholder="Qty" placeholder="Qty"
disabled={ !this.props.user?.currentUser } disabled={ !this.props.user?.currentUser }
...@@ -110,7 +111,11 @@ export default class ProductItem extends Component { ...@@ -110,7 +111,11 @@ export default class ProductItem extends Component {
min="1" min="1"
max="99" max="99"
/> />
<button disabled={ !this.props.user?.currentUser } className="add-to-cart-button">Add to Cart</button> <button
disabled={ !this.props.user?.currentUser }
className="add-to-cart-button"
id={ this.props.user?.currentUser ? "" : "disabled" }
>Add to Cart</button>
</form> </form>
<Modal <Modal
......
...@@ -38,8 +38,8 @@ export default class ProductMarket extends Component { ...@@ -38,8 +38,8 @@ export default class ProductMarket extends Component {
<div className="products-container"> <div className="products-container">
{this.props.products.map(prod => { {this.props.products.map(prod => {
return ( return (
<div className={prod.availableStock > 0 ? "product-item-container" : "no-item"} key={ prod.sku }> <div className={prod.availableStock >= 0 ? "product-item-container" : "no-item"} key={ prod.sku }>
{ prod.availableStock > 0 ? "" : <p id="out-of-stock">- Out of Stock -</p> } { prod.availableStock >= 0 ? "" : <p id="out-of-stock">- Out of Stock -</p> }
{ prod.productName ? { prod.productName ?
<ProductItem <ProductItem
item={ prod } item={ prod }
......
...@@ -39,14 +39,17 @@ ...@@ -39,14 +39,17 @@
width: 330px; width: 330px;
height: 335px; height: 335px;
margin: 8px; margin: 8px;
opacity: 0.4; opacity: 0.6;
} }
#out-of-stock { #out-of-stock {
background: white;
position: absolute; position: absolute;
width: 100%;
text-align: center;
font-size: 35px; font-size: 35px;
top: 80px; top: 80px;
left: 48px; opacity: 0.5;
z-index: 50; z-index: 50;
} }
...@@ -421,6 +424,10 @@ ...@@ -421,6 +424,10 @@
color: red; color: red;
} }
#disabled {
pointer-events: none;
}
/* 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