| 1 |
import {PricingPlanCard} from './PricingPlanCard'; |
| 2 |
import {Hero} from './Hero'; |
| 3 |
import styles from './PricingPlans.module.css'; |
| 4 |
|
| 5 |
const {heading, description, plansButtonCaption, plans} = window.GiveAddons.pricingPlans; |
| 6 |
|
| 7 |
const customPlanOrder = ['Plus Plan', 'Pro Plan', 'Basic Plan', 'Agency Plan']; |
| 8 |
|
| 9 |
const sortedPlans = plans.slice().sort((a, b) => { |
| 10 |
const aIndex = customPlanOrder.indexOf(a.name); |
| 11 |
const bIndex = customPlanOrder.indexOf(b.name); |
| 12 |
return aIndex - bIndex; |
| 13 |
}); |
| 14 |
|
| 15 |
export const PricingPlans = () => ( |
| 16 |
<article> |
| 17 |
<Hero heading={heading} description={description} /> |
| 18 |
<ul className={styles.plans}> |
| 19 |
{sortedPlans.map((plan) => ( |
| 20 |
<li key={plan.name}> |
| 21 |
<PricingPlanCard |
| 22 |
name={plan.name} |
| 23 |
description={plan.description} |
| 24 |
actionText={plansButtonCaption} |
| 25 |
actionLink={plan.url} |
| 26 |
icon={plan.icon} |
| 27 |
savingsPercentage={plan.savingsPercentage} |
| 28 |
includes={plan.includes} |
| 29 |
isMostPopular={plan.mostPopular} |
| 30 |
/> |
| 31 |
</li> |
| 32 |
))} |
| 33 |
</ul> |
| 34 |
</article> |
| 35 |
); |
| 36 |
|