This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mini Cart block: add footer (subtotal, cart & checkout buttons and pa…
…yment method icons) (#4982) Co-authored-by: Albert Juhé Lluveras <[email protected]>
- Loading branch information
1 parent
c0a1f94
commit 2f2ac00
Showing
6 changed files
with
182 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import type { | ||
PaymentMethods, | ||
PaymentMethodIcons as PaymentMethodIconsType, | ||
} from '@woocommerce/type-defs/payments'; | ||
|
||
/** | ||
* Get the provider icons from payment methods data. | ||
* | ||
* @todo Refactor the Cart blocks to use getIconsFromPaymentMethods utility instead of the local copy. | ||
* | ||
* @param {PaymentMethods} paymentMethods Payment Method data | ||
* @return {PaymentMethodIconsType} Payment Method icons data. | ||
*/ | ||
export const getIconsFromPaymentMethods = ( | ||
paymentMethods: PaymentMethods | ||
): PaymentMethodIconsType => { | ||
return Object.values( paymentMethods ).reduce( ( acc, paymentMethod ) => { | ||
if ( paymentMethod.icons !== null ) { | ||
acc = acc.concat( paymentMethod.icons ); | ||
} | ||
return acc; | ||
}, [] as PaymentMethodIconsType ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters