mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
✨ Disable the Connect-button during login
This commit is contained in:
parent
3174bc158f
commit
4f3c4e6f3d
1 changed files with 4 additions and 0 deletions
|
@ -2,6 +2,7 @@ import { Button } from '@wordpress/components';
|
||||||
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
|
import { CommonHooks } from '../../../../data';
|
||||||
import { openSignup } from '../../../ReusableComponents/Icons';
|
import { openSignup } from '../../../ReusableComponents/Icons';
|
||||||
import {
|
import {
|
||||||
useProductionConnection,
|
useProductionConnection,
|
||||||
|
@ -14,11 +15,13 @@ const ConnectionButton = ( {
|
||||||
variant = 'primary',
|
variant = 'primary',
|
||||||
showIcon = true,
|
showIcon = true,
|
||||||
} ) => {
|
} ) => {
|
||||||
|
const { isBusy } = CommonHooks.useBusyState();
|
||||||
const { handleSandboxConnect } = useSandboxConnection();
|
const { handleSandboxConnect } = useSandboxConnection();
|
||||||
const { handleProductionConnect } = useProductionConnection();
|
const { handleProductionConnect } = useProductionConnection();
|
||||||
const className = classNames( 'ppcp-r-connection-button', {
|
const className = classNames( 'ppcp-r-connection-button', {
|
||||||
'sandbox-mode': isSandbox,
|
'sandbox-mode': isSandbox,
|
||||||
'live-mode': ! isSandbox,
|
'live-mode': ! isSandbox,
|
||||||
|
'ppcp--is-loading': isBusy,
|
||||||
} );
|
} );
|
||||||
|
|
||||||
const handleConnectClick = async () => {
|
const handleConnectClick = async () => {
|
||||||
|
@ -35,6 +38,7 @@ const ConnectionButton = ( {
|
||||||
variant={ variant }
|
variant={ variant }
|
||||||
icon={ showIcon ? openSignup : null }
|
icon={ showIcon ? openSignup : null }
|
||||||
onClick={ handleConnectClick }
|
onClick={ handleConnectClick }
|
||||||
|
disabled={ isBusy }
|
||||||
>
|
>
|
||||||
<span className="button-title">{ title }</span>
|
<span className="button-title">{ title }</span>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue