Skip to content

Commit

Permalink
Forwarded props to handle closing the cart upon a click on the backdrop
Browse files Browse the repository at this point in the history
  • Loading branch information
commit-kyle committed May 11, 2021
1 parent e5c1a6f commit b4e7d25
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion specialtea/src/components/Cart/Cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Cart = props => {
);

return (
<Modal>
<Modal onClick={props.onHideCart}>
{cartItems}
<div className={classes.total}>
<span>Total Amount</span>
Expand Down
4 changes: 2 additions & 2 deletions specialtea/src/components/UI/Modal/Backdrop/Backdrop.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import classes from './Backdrop.module.css';

const Backdrop = () => {
return <div className={classes.backdrop}></div>;
const Backdrop = props => {
return <div className={classes.backdrop} onClick={props.onClick}></div>;
};

export default Backdrop;
2 changes: 1 addition & 1 deletion specialtea/src/components/UI/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Modal = props => {

return (
<Fragment>
{ReactDOM.createPortal(<Backdrop />, portalElement)}
{ReactDOM.createPortal(<Backdrop onClick={props.onClick}/>, portalElement)}
{ReactDOM.createPortal(
<Overlay>{props.children}</Overlay>,
portalElement
Expand Down

0 comments on commit b4e7d25

Please sign in to comment.