From 950495c8368fb53554481bbc33d704f36d0f653b Mon Sep 17 00:00:00 2001 From: Rishabh Date: Fri, 11 Jun 2021 14:03:20 +0530 Subject: [PATCH] Updated product selection to work on full card refs https://github.com/TryGhost/Team/issues/767 - handles product selection on full product card instead of just small surface area on checkbox - removes dummy product card method --- .../src/components/common/ProductsSection.js | 66 +++---------------- 1 file changed, 9 insertions(+), 57 deletions(-) diff --git a/ghost/portal/src/components/common/ProductsSection.js b/ghost/portal/src/components/common/ProductsSection.js index 5b0651f35c..9eded2fb5a 100644 --- a/ghost/portal/src/components/common/ProductsSection.js +++ b/ghost/portal/src/components/common/ProductsSection.js @@ -264,6 +264,7 @@ function Checkbox({name, id, onProductSelect, isChecked, disabled = false}) { disabled={disabled} /> { + e.stopPropagation(); if (!disabled) { onProductSelect(e, id); } @@ -297,7 +298,10 @@ function ProductCard({product}) { const {selectedProduct, setSelectedProduct} = useContext(ProductsContext); return ( -
+
{ + e.stopPropagation(); + setSelectedProduct(product.id); + }}>
{ setSelectedProduct(product.id); @@ -318,65 +322,13 @@ function ProductCards({products}) { }); } -/** Dummy static products for UI development */ -/* -function DummyProductCards({products}) { - return ( - <> -
-
- -

Bronze

-
Access to all members articles
-
-
-
- $ - 70 - /year -
-
$7/month
-
-
-
-
- -

Silver

-
Access to all members articles and weekly podcast
-
-
-
- $ - 120 - /year -
-
$12/month
-
-
-
-
- -

Gold

-
Access to all members articles, weekly podcast and exclusive interviews
-
-
-
- $ - 1000 - /year -
-
$12/month
-
-
- - ); -} -*/ - function FreeProductCard() { const {selectedProduct, setSelectedProduct} = useContext(ProductsContext); return ( -
+
{ + e.stopPropagation(); + setSelectedProduct('free'); + }}>
{ setSelectedProduct('free');