mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Disable subscriptions if personal account
This commit is contained in:
parent
afe05d4697
commit
1ef7141903
2 changed files with 60 additions and 41 deletions
|
@ -9,7 +9,13 @@ const OptionSelector = ( {
|
|||
} ) => (
|
||||
<div className="ppcp-r-select-box-wrapper">
|
||||
{ options.map(
|
||||
( { value: itemValue, title, description, contents } ) => {
|
||||
( {
|
||||
value: itemValue,
|
||||
title,
|
||||
description,
|
||||
contents,
|
||||
isDisabled = false,
|
||||
} ) => {
|
||||
let isSelected;
|
||||
|
||||
if ( Array.isArray( value ) ) {
|
||||
|
@ -27,6 +33,7 @@ const OptionSelector = ( {
|
|||
onChange={ onChange }
|
||||
isMulti={ multiSelect }
|
||||
isSelected={ isSelected }
|
||||
isDisabled={ isDisabled }
|
||||
>
|
||||
{ contents }
|
||||
</OptionItem>
|
||||
|
@ -46,13 +53,13 @@ const OptionItem = ( {
|
|||
isMulti,
|
||||
isSelected,
|
||||
children,
|
||||
isDisabled = false,
|
||||
} ) => {
|
||||
const boxClassName = classNames( 'ppcp-r-select-box', {
|
||||
'ppcp--selected': isSelected,
|
||||
'ppcp--multiselect': isMulti,
|
||||
'ppcp--no-title': ! itemTitle,
|
||||
} );
|
||||
|
||||
return (
|
||||
// eslint-disable-next-line jsx-a11y/label-has-associated-control -- label has a nested input control.
|
||||
<label className={ boxClassName }>
|
||||
|
@ -61,6 +68,7 @@ const OptionItem = ( {
|
|||
isRadio={ ! isMulti }
|
||||
onChange={ onChange }
|
||||
isSelected={ isSelected }
|
||||
isDisabled={ isDisabled }
|
||||
/>
|
||||
|
||||
<div className="ppcp--box-content">
|
||||
|
@ -80,7 +88,7 @@ const OptionItem = ( {
|
|||
);
|
||||
};
|
||||
|
||||
const InputField = ( { value, onChange, isRadio, isSelected } ) => {
|
||||
const InputField = ( { value, onChange, isRadio, isSelected, isDisabled } ) => {
|
||||
if ( isRadio ) {
|
||||
return (
|
||||
<PayPalRdb
|
||||
|
@ -96,6 +104,7 @@ const InputField = ( { value, onChange, isRadio, isSelected } ) => {
|
|||
value={ value }
|
||||
onChange={ onChange }
|
||||
checked={ isSelected }
|
||||
disabled={ isDisabled }
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue