♻️ Replace generatePriceText with custom component

This commit is contained in:
Philipp Stracker 2024-12-12 16:55:19 +01:00
parent a3b68aae14
commit e59ae23c43
No known key found for this signature in database
8 changed files with 159 additions and 125 deletions

View file

@ -1,8 +1,8 @@
import BadgeBox from '../BadgeBox';
import { __, sprintf } from '@wordpress/i18n';
import BadgeBox from '../BadgeBox';
import Separator from '../Separator';
import generatePriceText from '../../../utils/badgeBoxUtils';
import { countryPriceInfo } from '../../../utils/countryPriceInfo';
import PricingTitleBadge from '../PricingTitleBadge';
const AcdcOptionalPaymentMethods = ( {
isFastlane,
@ -24,11 +24,13 @@ const AcdcOptionalPaymentMethods = ( {
'icon-button-amex.svg',
'icon-button-discover.svg',
] }
textBadge={ generatePriceText(
'ccf',
countryPriceInfo[ storeCountry ],
storeCurrency
) }
textBadge={
<PricingTitleBadge
item="ccf"
currency={ storeCurrency }
country={ storeCountry }
/>
}
description={ sprintf(
// translators: %s: Link to PayPal business fees guide
__(
@ -48,11 +50,13 @@ const AcdcOptionalPaymentMethods = ( {
'icon-button-apple-pay.svg',
'icon-button-google-pay.svg',
] }
textBadge={ generatePriceText(
'dw',
countryPriceInfo[ storeCountry ],
storeCurrency
) }
textBadge={
<PricingTitleBadge
item="dw"
currency={ storeCurrency }
country={ storeCountry }
/>
}
description={ sprintf(
// translators: %s: Link to PayPal business fees guide
__(
@ -73,11 +77,13 @@ const AcdcOptionalPaymentMethods = ( {
'icon-button-blik.svg',
'icon-button-bancontact.svg',
] }
textBadge={ generatePriceText(
'apm',
countryPriceInfo[ storeCountry ],
storeCurrency
) }
textBadge={
<PricingTitleBadge
item="apm"
currency={ storeCurrency }
country={ storeCountry }
/>
}
description={ sprintf(
// translators: %s: Link to PayPal business fees guide
__(
@ -91,11 +97,9 @@ const AcdcOptionalPaymentMethods = ( {
<BadgeBox
title={ __( '', 'woocommerce-paypal-payments' ) }
imageBadge={ [ 'icon-payment-method-fastlane-small.svg' ] }
textBadge={ generatePriceText(
'fastlane',
countryPriceInfo[ storeCountry ],
storeCurrency
) }
textBadge={
<PricingTitleBadge item="fast country currency=storeCurrency=storeCountrylane" />
}
description={ sprintf(
// translators: %s: Link to PayPal business fees guide
__(
@ -123,11 +127,13 @@ const AcdcOptionalPaymentMethods = ( {
'icon-button-amex.svg',
'icon-button-discover.svg',
] }
textBadge={ generatePriceText(
'ccf',
countryPriceInfo[ storeCountry ],
storeCurrency
) }
textBadge={
<PricingTitleBadge
item="ccf"
currency={ storeCurrency }
country={ storeCountry }
/>
}
description={ sprintf(
// translators: %s: Link to PayPal business fees guide
__(
@ -147,11 +153,13 @@ const AcdcOptionalPaymentMethods = ( {
'icon-button-apple-pay.svg',
'icon-button-google-pay.svg',
] }
textBadge={ generatePriceText(
'dw',
countryPriceInfo[ storeCountry ],
storeCurrency
) }
textBadge={
<PricingTitleBadge
item="dw"
currency={ storeCurrency }
country={ storeCountry }
/>
}
description={ sprintf(
// translators: %s: Link to PayPal business fees guide
__(
@ -173,11 +181,13 @@ const AcdcOptionalPaymentMethods = ( {
'icon-button-blik.svg',
'icon-button-bancontact.svg',
] }
textBadge={ generatePriceText(
'apm',
countryPriceInfo[ storeCountry ],
storeCurrency
) }
textBadge={
<PricingTitleBadge
item="apm"
currency={ storeCurrency }
country={ storeCountry }
/>
}
description={ sprintf(
// translators: %s: Link to PayPal business fees guide
__(
@ -204,11 +214,13 @@ const AcdcOptionalPaymentMethods = ( {
'icon-button-amex.svg',
'icon-button-discover.svg',
] }
textBadge={ generatePriceText(
'ccf',
countryPriceInfo[ storeCountry ],
storeCurrency
) }
textBadge={
<PricingTitleBadge
item="ccf"
currency={ storeCurrency }
country={ storeCountry }
/>
}
description={ sprintf(
// translators: %s: Link to PayPal business fees guide
__(
@ -225,11 +237,13 @@ const AcdcOptionalPaymentMethods = ( {
'icon-button-apple-pay.svg',
'icon-button-google-pay.svg',
] }
textBadge={ generatePriceText(
'dw',
countryPriceInfo[ storeCountry ],
storeCurrency
) }
textBadge={
<PricingTitleBadge
item="dw"
currency={ storeCurrency }
country={ storeCountry }
/>
}
description={ sprintf(
// translators: %s: Link to PayPal business fees guide
__(
@ -251,11 +265,13 @@ const AcdcOptionalPaymentMethods = ( {
'icon-button-blik.svg',
'icon-button-bancontact.svg',
] }
textBadge={ generatePriceText(
'apm',
countryPriceInfo[ storeCountry ],
storeCurrency
) }
textBadge={
<PricingTitleBadge
item="apm"
currency={ storeCurrency }
country={ storeCountry }
/>
}
description={ sprintf(
// translators: %s: Link to PayPal business fees guide
__(

View file

@ -1,7 +1,7 @@
import BadgeBox from '../BadgeBox';
import { __, sprintf } from '@wordpress/i18n';
import generatePriceText from '../../../utils/badgeBoxUtils';
import { countryPriceInfo } from '../../../utils/countryPriceInfo';
import BadgeBox from '../BadgeBox';
import PricingTitleBadge from '../PricingTitleBadge';
const BcdcOptionalPaymentMethods = ( {
isPayLater,
@ -22,11 +22,13 @@ const BcdcOptionalPaymentMethods = ( {
'icon-button-amex.svg',
'icon-button-discover.svg',
] }
textBadge={ generatePriceText(
'standardCardFields',
countryPriceInfo[ storeCountry ],
storeCurrency
) }
textBadge={
<PricingTitleBadge
item="standardCardFields"
currency={ storeCurrency }
country={ storeCountry }
/>
}
description={ sprintf(
// translators: %s: Link to PayPal REST application guide
__(
@ -53,11 +55,13 @@ const BcdcOptionalPaymentMethods = ( {
'icon-button-amex.svg',
'icon-button-discover.svg',
] }
textBadge={ generatePriceText(
'standardCardFields',
countryPriceInfo[ storeCountry ],
storeCurrency
) }
textBadge={
<PricingTitleBadge
item="standardCardFields"
currency={ storeCurrency }
country={ storeCountry }
/>
}
description={ sprintf(
// translators: %s: Link to PayPal REST application guide
__(