Skip to content

Commit

Permalink
Updated icon_url instead of using conditional in the frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
gpressutto5 committed Sep 25, 2024
1 parent 91ebb85 commit 0241d4b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions client/checkout/blocks/payment-method-label.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { normalizeCurrencyToMinorUnit } from '../utils';
import { getUPEConfig } from 'wcpay/utils/checkout';
import { __ } from '@wordpress/i18n';
import './style.scss';
import GenericCardIcon from 'assets/images/payment-method-icons/generic-card.svg?asset';

export default ( {
api,
Expand Down Expand Up @@ -37,12 +36,6 @@ export default ( {
window.wcBlocksCheckoutData?.storeCountry ||
'US';

let icon =
upeAppearanceTheme === 'night' ? upeConfig.darkIcon : upeConfig.icon;
if ( upeName === 'card' ) {
icon = GenericCardIcon;
}

return (
<>
<div className="payment-method-label">
Expand All @@ -56,7 +49,11 @@ export default ( {
) }
<img
className="payment-methods--logos"
src={ icon }
src={
upeAppearanceTheme === 'night'
? upeConfig.darkIcon
: upeConfig.icon
}
alt={ upeConfig.title }
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion includes/payment-methods/class-cc-payment-method.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct( $token_service ) {
$this->title = __( 'Credit card / debit card', 'woocommerce-payments' );
$this->is_reusable = true;
$this->currencies = [];// All currencies are supported.
$this->icon_url = plugins_url( 'assets/images/payment-methods/cc.svg', WCPAY_PLUGIN_FILE );
$this->icon_url = plugins_url( 'assets/images/payment-methods/generic-card.svg', WCPAY_PLUGIN_FILE );
}

/**
Expand Down

0 comments on commit 0241d4b

Please sign in to comment.