Skip to content

Commit

Permalink
feat: displays per month/year in priceCards now
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-daniel-dempsey committed Jan 13, 2025
1 parent e578e53 commit 6009198
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
LinkButton,
} from '@guardian/source/react-components';
import { useState } from 'react';
import type { PriceCardPaymentInterval } from 'components/priceCards/priceCard';
import { OtherAmount } from '../../../components/otherAmount/otherAmount';
import { PriceCards } from '../../../components/priceCards/priceCards';
import type {
Expand Down Expand Up @@ -90,6 +91,13 @@ export function AmountsCard({
? `one-time-checkout?contribution=${amount}`
: `checkout?product=Contribution&ratePlan=${billingPeriod}&contribution=${amount}`;

const contributionTypeToPaymentInterval: Partial<
Record<ContributionType, PriceCardPaymentInterval>
> = {
MONTHLY: 'month',
ANNUAL: 'year',
};

return (
<section css={sectionStyle}>
<div
Expand All @@ -103,6 +111,7 @@ export function AmountsCard({
amounts={amountsData.amounts}
selectedAmount={selectedAmount}
currency={currencyId}
paymentInterval={contributionTypeToPaymentInterval[contributionType]}
onAmountChange={(amount: string) => {
if (amount === 'other') {
setSelectedAmount(amount);
Expand Down

0 comments on commit 6009198

Please sign in to comment.