From afd51e0e34823fde6362bc6f6212d84990fe2969 Mon Sep 17 00:00:00 2001 From: Peter Zimon Date: Wed, 28 Apr 2021 14:05:31 +0200 Subject: [PATCH] Updated no description price name style --- .../src/components/common/PlansSection.js | 29 ++++++++++--------- .../portal/src/components/pages/SignupPage.js | 4 +-- ghost/portal/src/utils/helpers.js | 4 +-- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/ghost/portal/src/components/common/PlansSection.js b/ghost/portal/src/components/common/PlansSection.js index 2153b4ad9e..1f57ec22c1 100644 --- a/ghost/portal/src/components/common/PlansSection.js +++ b/ghost/portal/src/components/common/PlansSection.js @@ -294,9 +294,13 @@ export const PlanSectionStyles = ` .gh-portal-plans-container.vertical.hide-checkbox .gh-portal-plan-featurewrapper { grid-column: 1 / 2; } + + .gh-portal-plans-container.vertical .gh-portal-plan-name.no-description { + grid-row: 1 / 3; + } `; -function Checkbox({name, onPlanSelect, isChecked, disabled}) { +function Checkbox({name, id, onPlanSelect, isChecked, disabled}) { if (isCookiesDisabled()) { disabled = true; } @@ -304,11 +308,11 @@ function Checkbox({name, onPlanSelect, isChecked, disabled}) {
onPlanSelect(e, name)} + onChange={e => onPlanSelect(e, id)} disabled={disabled} /> @@ -331,8 +335,8 @@ function PlanOptions({plans, selectedPlan, onPlanSelect, changePlan}) { const hasMonthlyPlan = plans.some(({name}) => { return name === 'Monthly'; }); - return plans.map(({name, currency_symbol: currencySymbol, price, discount}, i) => { - const isChecked = selectedPlan === name; + return plans.map(({name, currency_symbol: currencySymbol, price, discount, id}, i) => { + const isChecked = selectedPlan === (id || name); const classes = (isChecked ? 'gh-portal-plan-section checked' : 'gh-portal-plan-section'); const planDetails = {}; let displayName = ''; @@ -348,26 +352,23 @@ function PlanOptions({plans, selectedPlan, onPlanSelect, changePlan}) { displayName = 'Annually'; planDetails.feature = ((hasMonthlyPlan && discount > 0) ? (discount + '% discount') : 'Full access'); break; - - // TODO: mock! - case 'Custom': - displayName = 'Custom'; + default: planDetails.feature = ((hasMonthlyPlan && discount > 0) ? (discount + '% discount') : 'Full access'); break; - - default: - break; } + + const planNameClass = planDetails.feature ? 'gh-portal-plan-name' : 'gh-portal-plan-name no-description'; + return (
onPlanSelect(e, name)}> -

{displayName || name}

+

{displayName || name}

{planDetails.feature}
- {(changePlan && selectedPlan === name ? Current plan : '')} + {(changePlan && selectedPlan === id ? Current plan : '')}
); diff --git a/ghost/portal/src/components/pages/SignupPage.js b/ghost/portal/src/components/pages/SignupPage.js index 05ee4f72d8..a964f8e6bf 100644 --- a/ghost/portal/src/components/pages/SignupPage.js +++ b/ghost/portal/src/components/pages/SignupPage.js @@ -246,7 +246,7 @@ class SignupPage extends React.Component { getDefaultSelectedPlan(plans = [], selectedPlan) { if (!plans || plans.length === 0) { - return 'Free'; + return 'free'; } const hasSelectedPlan = plans.some((p) => { @@ -254,7 +254,7 @@ class SignupPage extends React.Component { }); if (!hasSelectedPlan) { - return plans[0].name || 'Free'; + return plans[0].name || 'free'; } return selectedPlan; diff --git a/ghost/portal/src/utils/helpers.js b/ghost/portal/src/utils/helpers.js index 2f49754167..f497a2f9e1 100644 --- a/ghost/portal/src/utils/helpers.js +++ b/ghost/portal/src/utils/helpers.js @@ -186,17 +186,17 @@ export function getSitePrices({site = {}, includeFree = true, pageQuery} = {}) { const stripePrices = prices.map((d) => { return { ...d, - type: 'custom', price: d.amount / 100, name: d.nickname, currency_symbol: getCurrencySymbol(d.currency) }; }).filter((price) => { - return price.amount !== 0; + return price.amount !== 0 && price.type === 'recurring'; }); if (allowSelfSignup && portalPlans.includes('free') && includeFree) { plansData.push({ + id: 'free', type: 'free', price: 0, currency_symbol: '$',