AdditionalAddonCard.js
4 years ago
AdditionalAddonCard.module.css
4 years ago
AdditionalAddons.js
4 years ago
AdditionalAddons.module.css
4 years ago
AddonsAdminPage.js
4 years ago
AddonsAdminPage.module.css
4 years ago
Button.js
4 years ago
Button.module.css
4 years ago
Card.js
4 years ago
Card.module.css
4 years ago
FreeAddOnTab.js
4 years ago
FreeAddOnTab.module.css
4 years ago
Hero.js
4 years ago
Hero.module.css
4 years ago
MustHaveAddonCard.js
4 years ago
MustHaveAddonCard.module.css
4 years ago
MustHaveAddons.js
4 years ago
MustHaveAddons.module.css
4 years ago
PricingPlanCard.js
4 years ago
PricingPlanCard.module.css
4 years ago
PricingPlans.js
4 years ago
PricingPlans.module.css
4 years ago
RecurringDonationsTab.js
4 years ago
RecurringDonationsTab.module.scss
4 years ago
PricingPlanCard.js
64 lines
| 1 | import {useMemo} from 'react'; |
| 2 | import {kebabCase} from 'lodash'; |
| 3 | import {Button} from './Button'; |
| 4 | import {Card} from './Card'; |
| 5 | import {transformEmphasis, transformStrong} from '../utils'; |
| 6 | |
| 7 | import styles from './PricingPlanCard.module.css'; |
| 8 | |
| 9 | export const PricingPlanCard = ({ |
| 10 | name, |
| 11 | description, |
| 12 | actionText, |
| 13 | actionLink, |
| 14 | icon, |
| 15 | includes, |
| 16 | savingsPercentage, |
| 17 | isMostPopular, |
| 18 | }) => { |
| 19 | const includesLabelId = useMemo(() => `${kebabCase(name)}-includes-label`, [name]); |
| 20 | |
| 21 | return ( |
| 22 | <Card as="article" className={styles.card}> |
| 23 | <div> |
| 24 | <div className={styles.nameAndFlag}> |
| 25 | <h3 className={styles.title}> |
| 26 | <img className={styles.icon} src={icon} alt="" /> |
| 27 | {name} |
| 28 | </h3> |
| 29 | {isMostPopular && <div className={styles.mostPopularFlag}>Most Popular</div>} |
| 30 | </div> |
| 31 | <p className={styles.description} dangerouslySetInnerHTML={{__html: transformStrong(description)}} /> |
| 32 | <div className={styles.actionAndSavings}> |
| 33 | <Button as="a" href={actionLink} rel="noopener" target="_blank" className={styles.button}> |
| 34 | {actionText} |
| 35 | </Button> |
| 36 | <p className={styles.savings}>Save over {savingsPercentage}%</p> |
| 37 | </div> |
| 38 | </div> |
| 39 | <aside aria-labelledby={includesLabelId} className={styles.includes}> |
| 40 | <h4 id={includesLabelId} className={styles.includesLabel}> |
| 41 | <span className="screen-reader-text">{name} </span>Includes |
| 42 | </h4> |
| 43 | <ul className={styles.includesList}> |
| 44 | {includes.map((include) => ( |
| 45 | <li key={include.feature} className={styles.include}> |
| 46 | {include.icon && <img src={include.icon} alt="" className={styles.includeIcon} />} |
| 47 | {include.link ? ( |
| 48 | <a |
| 49 | href={include.link} |
| 50 | target="_blank" |
| 51 | rel="noopener" |
| 52 | dangerouslySetInnerHTML={{__html: transformEmphasis(include.feature)}} |
| 53 | /> |
| 54 | ) : ( |
| 55 | <span dangerouslySetInnerHTML={{__html: transformEmphasis(include.feature)}} /> |
| 56 | )} |
| 57 | </li> |
| 58 | ))} |
| 59 | </ul> |
| 60 | </aside> |
| 61 | </Card> |
| 62 | ); |
| 63 | }; |
| 64 |