({
option,
checked,
onChange,
shouldShowMonthlyPrice,
shouldShowDuration,
isOrganization,
}: PlusOptionRadioProps)
| 21 | } |
| 22 | |
| 23 | export function PlusOptionRadio({ |
| 24 | option, |
| 25 | checked, |
| 26 | onChange, |
| 27 | shouldShowMonthlyPrice, |
| 28 | shouldShowDuration, |
| 29 | isOrganization, |
| 30 | }: PlusOptionRadioProps): ReactElement | null { |
| 31 | if (!option) { |
| 32 | return null; |
| 33 | } |
| 34 | |
| 35 | const { metadata, priceId, price, originalPrice } = option; |
| 36 | const finalPrice = shouldShowMonthlyPrice |
| 37 | ? price.monthly?.formatted || price.formatted |
| 38 | : price.formatted; |
| 39 | const regularPrice = |
| 40 | originalPrice && |
| 41 | (shouldShowMonthlyPrice |
| 42 | ? originalPrice.monthly?.formatted || originalPrice.formatted |
| 43 | : originalPrice.formatted); |
| 44 | |
| 45 | return ( |
| 46 | <RadioItem |
| 47 | key={priceId} |
| 48 | name={metadata.title} |
| 49 | id={`${metadata.title}-${priceId}`} |
| 50 | value={priceId} |
| 51 | checked={checked} |
| 52 | onChange={() => onChange?.(priceId)} |
| 53 | className={{ |
| 54 | content: classNames( |
| 55 | 'min-h-12 rounded-10 !p-2', |
| 56 | checked |
| 57 | ? '-m-px border border-border-subtlest-primary bg-surface-float' |
| 58 | : undefined, |
| 59 | ), |
| 60 | }} |
| 61 | > |
| 62 | <div className="flex flex-1 flex-wrap items-center gap-x-3 gap-y-1"> |
| 63 | <Typography |
| 64 | tag={TypographyTag.Span} |
| 65 | type={TypographyType.Callout} |
| 66 | color={TypographyColor.Primary} |
| 67 | > |
| 68 | {metadata.title} |
| 69 | </Typography> |
| 70 | |
| 71 | {metadata.caption && ( |
| 72 | <PlusPlanExtraLabel |
| 73 | color={metadata.caption.color} |
| 74 | label={metadata.caption.copy} |
| 75 | /> |
| 76 | )} |
| 77 | </div> |
| 78 | <div className="ml-auto mr-1 flex items-center gap-1"> |
| 79 | {regularPrice && regularPrice !== finalPrice && ( |
| 80 | <Typography |
nothing calls this directly
no test coverage detected