mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
use component instead of function
This commit is contained in:
parent
c2c4347ce2
commit
f004be97ff
1 changed files with 24 additions and 28 deletions
|
@ -5,35 +5,31 @@ const ConnectionInfo = () => {
|
||||||
const { merchant } = CommonHooks.useMerchantInfo();
|
const { merchant } = CommonHooks.useMerchantInfo();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="ppcp-r-connection-status__data">
|
<div className="ppcp-r-connection-status__data">
|
||||||
{renderStatusRow(
|
<StatusRow
|
||||||
__('Merchant ID', 'woocommerce-paypal-payments'),
|
label={ __( 'Merchant ID', 'woocommerce-paypal-payments' ) }
|
||||||
connectionData.merchantId
|
value={ merchant.id }
|
||||||
)}
|
/>
|
||||||
{renderStatusRow(
|
<StatusRow
|
||||||
__('Email address', 'woocommerce-paypal-payments'),
|
label={ __( 'Email address', 'woocommerce-paypal-payments' ) }
|
||||||
connectionData.email
|
value={ merchant.email }
|
||||||
)}
|
/>
|
||||||
{renderStatusRow(
|
<StatusRow
|
||||||
__('Client ID', 'woocommerce-paypal-payments'),
|
label={ __( 'Client ID', 'woocommerce-paypal-payments' ) }
|
||||||
connectionData.clientId
|
value={ merchant.clientId }
|
||||||
)}
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default ConnectionInfo;
|
export default ConnectionInfo;
|
||||||
|
|
||||||
return {
|
const StatusRow = ( { label, value } ) => (
|
||||||
connectionStatus: merchant.isConnected || false,
|
<div className="ppcp-r-connection-status__status-row">
|
||||||
email: merchant.email || '',
|
<span className="ppcp-r-connection-status__status-label">
|
||||||
merchantId: merchant.id || '',
|
{ label }
|
||||||
clientId: merchant.clientId || '',
|
</span>
|
||||||
};
|
<span className="ppcp-r-connection-status__status-value">
|
||||||
};
|
{ value }
|
||||||
|
</span>
|
||||||
const renderStatusRow = (label, value) => (
|
</div>
|
||||||
<div className="ppcp-r-connection-status__status-row">
|
|
||||||
<span className="ppcp-r-connection-status__status-label">{label}</span>
|
|
||||||
<span className="ppcp-r-connection-status__status-value">{value}</span>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue