({
productList,
selected,
onChange,
className,
}: PlusProductListProps)
| 22 | }; |
| 23 | |
| 24 | const PlusProductList = ({ |
| 25 | productList, |
| 26 | selected, |
| 27 | onChange, |
| 28 | className, |
| 29 | }: PlusProductListProps): ReactElement => { |
| 30 | const { logSubscriptionEvent } = usePlusSubscription(); |
| 31 | |
| 32 | return ( |
| 33 | <div |
| 34 | className={classNames( |
| 35 | 'rounded-10 border border-border-subtlest-tertiary', |
| 36 | className, |
| 37 | )} |
| 38 | > |
| 39 | {productList.map(({ metadata, priceId, price, currency }) => ( |
| 40 | <RadioItem |
| 41 | key={priceId} |
| 42 | name={metadata.title} |
| 43 | id={`${metadata.title}-${priceId}`} |
| 44 | value={priceId} |
| 45 | checked={selected === priceId} |
| 46 | onChange={() => { |
| 47 | onChange?.(priceId); |
| 48 | logSubscriptionEvent({ |
| 49 | event_name: LogEvent.SelectBillingCycle, |
| 50 | target_id: metadata.title.toLowerCase(), |
| 51 | }); |
| 52 | }} |
| 53 | className={{ |
| 54 | content: classNames( |
| 55 | 'min-h-12 w-full rounded-10 !p-2', |
| 56 | selected === priceId |
| 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 | {metadata.caption && ( |
| 71 | <PlusPlanExtraLabel |
| 72 | color={metadata.caption.color} |
| 73 | label={metadata.caption.copy} |
| 74 | /> |
| 75 | )} |
| 76 | </div> |
| 77 | <div className="ml-auto mr-1 flex items-center gap-1"> |
| 78 | <Typography |
| 79 | tag={TypographyTag.Span} |
| 80 | type={TypographyType.Body} |
| 81 | color={TypographyColor.Primary} |
nothing calls this directly
no test coverage detected