Commit 6dfe5cf9 authored by Shaphen Pangburn's avatar Shaphen Pangburn

[AFP-48 Shaphen Pangburn]: Add user notice message to log in when hovering add to cart or quantity

parent 539fa080
...@@ -46,8 +46,13 @@ export default class ProductDetails extends Component { ...@@ -46,8 +46,13 @@ export default class ProductDetails extends Component {
: :
<p id="prod-details-original-price">Price: ${ this.props.product.price }</p> <p id="prod-details-original-price">Price: ${ this.props.product.price }</p>
} }
<input type="number" className="prod-details-quantity" placeholder="Quantity" /> <input
<button className="prod-details-add-to-cart"> type="number"
className="prod-details-quantity"
disabled={ !this.props.user?.currentUser }
placeholder="Quantity"
/>
<button className="prod-details-add-to-cart" disabled={ !this.props.user?.currentUser }>
Add to Cart Add to Cart
</button> </button>
</div> </div>
......
...@@ -7,7 +7,7 @@ export default class ProductItem extends Component { ...@@ -7,7 +7,7 @@ export default class ProductItem extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
orderItemQuantity: 0, orderItemQuantity: 1,
showDetailsModal: false showDetailsModal: false
} }
this.handleSubmit = this.handleSubmit.bind(this); this.handleSubmit = this.handleSubmit.bind(this);
...@@ -91,11 +91,14 @@ export default class ProductItem extends Component { ...@@ -91,11 +91,14 @@ export default class ProductItem extends Component {
{ "Save " + this.props.item.promo + "% on this item!"} { "Save " + this.props.item.promo + "% on this item!"}
</p> : ""} </p> : ""}
<form onSubmit={ e => this.handleSubmit(e, this.props.item) } className="add-cart-and-quantity"> <form onSubmit={ e => this.handleSubmit(e, this.props.item) } className="add-cart-and-quantity">
<p id="please-log-in-notice">Log in to Add to Cart</p>
<input <input
className="order-quantity" className="order-quantity"
type="number" type="number"
placeholder="Qty" placeholder="Qty"
disabled={ !this.props.user?.currentUser }
onChange={ this.handleChange("orderItemQuantity") } onChange={ this.handleChange("orderItemQuantity") }
value = { this.state.orderItemQuantity }
/> />
<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">Add to Cart</button>
</form> </form>
...@@ -125,7 +128,11 @@ export default class ProductItem extends Component { ...@@ -125,7 +128,11 @@ export default class ProductItem extends Component {
} }
}} }}
> >
<ProductDetails product={ this.props.item } discount={ discount } /> <ProductDetails
product={ this.props.item }
discount={ discount }
user={ this.props.user }
/>
</Modal> </Modal>
</div> </div>
) )
......
...@@ -175,6 +175,24 @@ ...@@ -175,6 +175,24 @@
.add-cart-and-quantity { .add-cart-and-quantity {
display: flex; display: flex;
position: relative;
}
#please-log-in-notice {
display: none;
position: absolute;
bottom: 47px;
left: 22px;
padding: 5px 10px;
border-radius: 5px;
background-color: rgb(248, 76, 76);
animation: fadeInUp;
animation-duration: 0.5s;
}
.add-cart-and-quantity:hover #please-log-in-notice {
display: block;
} }
#product-details-modal { #product-details-modal {
......
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