Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
optometrists
/
cache
/
cache
/
.wp-cli
/
wp-content
/
plugins
/
woocommerce
/
packages
/
woocommerce-blocks
/
assets
/
js
/
base
/
components
/
cart-checkout
/
payment-method-label
:
index.js
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
/** * External dependencies */ import classnames from 'classnames'; import { Icon, bank, bill, card, checkPayment } from '@woocommerce/icons'; /** * Internal dependencies */ import './style.scss'; const namedIcons = { bank, bill, card, checkPayment, }; /** * Exposed to payment methods for the label shown on checkout. Allows icons to be added as well as * text. * * @param {Object} props Component props. * @param {*} props.icon Show an icon beside the text if provided. Can be a string to use a named * icon, or an SVG element. * @param {string} props.text Text shown next to icon. */ export const PaymentMethodLabel = ( { icon = '', text = '' } ) => { const hasIcon = !! icon; const hasNamedIcon = hasIcon && typeof icon === 'string' && namedIcons[ icon ]; const className = classnames( 'wc-block-components-payment-method-label', { 'wc-block-components-payment-method-label--with-icon': hasIcon, } ); return ( <span className={ className }> { hasNamedIcon ? <Icon srcElement={ namedIcons[ icon ] } /> : icon } { text } </span> ); }; export default PaymentMethodLabel;