-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCart.js
More file actions
34 lines (31 loc) · 1.2 KB
/
Copy pathCart.js
File metadata and controls
34 lines (31 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import React from "react"
import classes from "./Cart.module.css"
import Modal from "./Modal"
const Cart = (props) => {
const cart_items = (
//we can write classes["cart-items"] like this because of this dash
<ul className={classes["cart-items"]}>
{[{ id: "c1", name: "Loaded Fries", price: 12.99 }].map((item) => (
<li key={item.id}>{item.name}</li>
))}
</ul>
)
return (
<Modal>
{cart_items}
<div className={classes.total}>
<span>Total Amount</span>
<span>35.62</span>
</div>
<div className={classes.actions}>
<button className={classes["button--alt"]} onClick={props.onCloseCart}>
{/* we can onClick={props.onCloseCart} also use in modal component */}
Close
</button>
<button className={classes.button}>Order</button>
</div>
</Modal>
)
}
export default Cart
//Wrapper component - that surround unknown components and provide a default structure to display the child components. A wrapper component may be used to create user interface (UI) components that are used frequently throughout a design, such as modals, template pages, and information tiles.