mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Fixed product card CTA for free trials
- product card was only showing free trial cta if there were more than one, which was incorrect
This commit is contained in:
parent
971a0dc06c
commit
f58011a276
1 changed files with 19 additions and 3 deletions
|
@ -565,7 +565,7 @@ function ProductCardAlternatePrice({price}) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ProductCardTrialDays({trialDays}) {
|
function ProductCardTrialDays({trialDays}) {
|
||||||
if (trialDays) {
|
if (trialDays) {
|
||||||
return (
|
return (
|
||||||
<span className="gh-portal-discount-label">{trialDays} days free</span>
|
<span className="gh-portal-discount-label">{trialDays} days free</span>
|
||||||
|
@ -700,6 +700,20 @@ function FreeProductCard({products, handleChooseSignup}) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ProductCardButton({selectedProduct, product, disabled, noOfProducts, trialDays}) {
|
||||||
|
if (selectedProduct === product.id && disabled) {
|
||||||
|
return (
|
||||||
|
<LoaderIcon className='gh-portal-loadingicon' />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trialDays > 0) {
|
||||||
|
return ('Start ' + trialDays + '-day free trial');
|
||||||
|
}
|
||||||
|
|
||||||
|
return (noOfProducts > 1 ? 'Choose' : 'Continue');
|
||||||
|
}
|
||||||
|
|
||||||
function ProductCard({product, products, selectedInterval, handleChooseSignup}) {
|
function ProductCard({product, products, selectedInterval, handleChooseSignup}) {
|
||||||
const {selectedProduct, setSelectedProduct} = useContext(ProductsContext);
|
const {selectedProduct, setSelectedProduct} = useContext(ProductsContext);
|
||||||
const {action} = useContext(AppContext);
|
const {action} = useContext(AppContext);
|
||||||
|
@ -747,7 +761,9 @@ function ProductCard({product, products, selectedInterval, handleChooseSignup})
|
||||||
const selectedPrice = getSelectedPrice({products, selectedInterval, selectedProduct: product.id});
|
const selectedPrice = getSelectedPrice({products, selectedInterval, selectedProduct: product.id});
|
||||||
handleChooseSignup(e, selectedPrice.id);
|
handleChooseSignup(e, selectedPrice.id);
|
||||||
}}>
|
}}>
|
||||||
{((selectedProduct === product.id && disabled) ? <LoaderIcon className='gh-portal-loadingicon' /> : (noOfProducts > 1 ? (trialDays > 0 ? 'Start ' + trialDays + '-day free trial' : 'Choose') : 'Continue'))}
|
<ProductCardButton
|
||||||
|
{...{selectedProduct, product, disabled, noOfProducts, trialDays}}
|
||||||
|
/>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -787,7 +803,7 @@ function ProductCard({product, products, selectedInterval, handleChooseSignup})
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ProductCards({products, selectedInterval, handleChooseSignup}) {
|
function ProductCards({products, selectedInterval, handleChooseSignup}) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue