doc: add hideButton to hide the button in orders page

This commit is contained in:
Leon Xu committed 2022-05-07 15:58:34 -07:00
1 parent d04cae7c01
commit 24e9fce241
1 file changed
+4 -2
+4 -2
View File
@@ -2,7 +2,7 @@ import React from "react";
import { useStateValue } from "../redux/StateProvider"; import { useStateValue } from "../redux/StateProvider";
import "./CheckoutProduct.css"; import "./CheckoutProduct.css";
function CheckoutProduct({ id, image, title, price, rating }) { function CheckoutProduct({ id, image, title, price, rating, hideButton }) {
const [{ bakset }, dispatch] = useStateValue(); const [{ bakset }, dispatch] = useStateValue();
const removeFromBasket = () => { const removeFromBasket = () => {
dispatch({ dispatch({
@@ -27,7 +27,9 @@ function CheckoutProduct({ id, image, title, price, rating }) {
<p>🌟</p> <p>🌟</p>
))} ))}
</article> </article>
<button onClick={removeFromBasket}>Remove from Basket</button> {!hideButton && (
<button onClick={removeFromBasket}>Remove from Basket</button>
)}
</article> </article>
</section> </section>
); );