mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-31 06:52:50 +08:00
Position the card icons beside the label instead of beneath the fields on the checkout form.
This commit is contained in:
parent
fcddaa1204
commit
7c111906ab
2 changed files with 28 additions and 23 deletions
|
@ -19,11 +19,9 @@ export function CardFields( {
|
|||
config,
|
||||
eventRegistration,
|
||||
emitResponse,
|
||||
components,
|
||||
} ) {
|
||||
const { onPaymentSetup } = eventRegistration;
|
||||
const { responseTypes } = emitResponse;
|
||||
const { PaymentMethodIcons } = components;
|
||||
|
||||
const [ cardFieldsForm, setCardFieldsForm ] = useState();
|
||||
const getCardFieldsForm = ( cardFieldsForm ) => {
|
||||
|
@ -95,10 +93,6 @@ export function CardFields( {
|
|||
} }
|
||||
>
|
||||
<PayPalCardFieldsForm />
|
||||
<PaymentMethodIcons
|
||||
icons={ config.card_icons }
|
||||
align="left"
|
||||
/>
|
||||
<CheckoutHandler
|
||||
getCardFieldsForm={ getCardFieldsForm }
|
||||
getSavePayment={ getSavePayment }
|
||||
|
|
|
@ -1,19 +1,30 @@
|
|||
import { registerPaymentMethod } from '@woocommerce/blocks-registry';
|
||||
import { CardFields } from './Components/card-fields';
|
||||
import {registerPaymentMethod} from '@woocommerce/blocks-registry';
|
||||
import {CardFields} from './Components/card-fields';
|
||||
|
||||
const config = wc.wcSettings.getSetting( 'ppcp-credit-card-gateway_data' );
|
||||
const config = wc.wcSettings.getSetting('ppcp-credit-card-gateway_data');
|
||||
|
||||
registerPaymentMethod( {
|
||||
name: config.id,
|
||||
label: <div dangerouslySetInnerHTML={ { __html: config.title } } />,
|
||||
content: <CardFields config={ config } />,
|
||||
edit: <CardFields config={ config } />,
|
||||
ariaLabel: config.title,
|
||||
canMakePayment: () => {
|
||||
return true;
|
||||
},
|
||||
supports: {
|
||||
showSavedCards: true,
|
||||
features: config.supports,
|
||||
},
|
||||
} );
|
||||
const Label = ({components, config}) => {
|
||||
const {PaymentMethodIcons} = components;
|
||||
return <>
|
||||
<span dangerouslySetInnerHTML={{__html: config.title}}/>
|
||||
<PaymentMethodIcons
|
||||
icons={ config.card_icons }
|
||||
align="right"
|
||||
/>
|
||||
</>
|
||||
}
|
||||
|
||||
registerPaymentMethod({
|
||||
name: config.id,
|
||||
label: <Label config={config}/>,
|
||||
content: <CardFields config={config}/>,
|
||||
edit: <CardFields config={config}/>,
|
||||
ariaLabel: config.title,
|
||||
canMakePayment: () => {
|
||||
return true;
|
||||
},
|
||||
supports: {
|
||||
showSavedCards: true,
|
||||
features: config.supports,
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue