add cart component with dummy data

main
oscar 2023-03-18 12:32:13 +13:00
parent cf733097b8
commit 3a2a44d828
2 changed files with 73 additions and 0 deletions

View File

@ -0,0 +1,27 @@
import classes from "./Cart.module.css";
const Cart = (props) => {
const cartItems = (
<ul className={classes["cart-items"]}>
{[{ id: "c1", name: "sushi", amount: 2, price: 12.99 }].map((item) => (
<li>{item.name}</li>
))}
</ul>
);
return (
<div>
{cartItems}
<div className={classes.total}>
<span>Total Amount</span>
<span>35.63</span>
</div>
<div className={classes.actions}>
<button className={classes["button--alt"]}>Close</button>
<button className={classes.button}>Order</button>
</div>
</div>
);
};
export default Cart;

View File

@ -0,0 +1,46 @@
.cart-items {
list-style: none;
margin: 0;
padding: 0;
max-height: 20rem;
overflow: auto;
}
.total {
display: flex;
justify-content: space-between;
align-items: center;
font-weight: bold;
font-size: 1.5rem;
margin: 1rem 0;
}
.actions {
text-align: right;
}
.actions button {
font: inherit;
cursor: pointer;
background-color: transparent;
border: 1px solid #8a2b06;
padding: 0.5rem 2rem;
border-radius: 25px;
margin-left: 1rem;
}
.actions button:hover,
.actions button:active {
background-color: #5a1a01;
border-color: #5a1a01;
color: white;
}
.actions .button--alt {
color: #8a2b06;
}
.actions .button {
background-color: #8a2b06;
color: white;
}