mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-07 19:54:15 +08:00
✨ Add busy-state to the save button
This commit is contained in:
parent
7365f75eba
commit
1726878f55
1 changed files with 16 additions and 10 deletions
|
@ -2,27 +2,33 @@ import { Button } from '@wordpress/components';
|
|||
import { __ } from '@wordpress/i18n';
|
||||
|
||||
import TopNavigation from '../../../ReusableComponents/TopNavigation';
|
||||
import { StylingHooks } from '../../../../data';
|
||||
import { CommonHooks, StylingHooks } from '../../../../data';
|
||||
import BusyStateWrapper from '../../../ReusableComponents/BusyStateWrapper';
|
||||
|
||||
const SettingsNavigation = () => {
|
||||
const { withActivity, isBusy } = CommonHooks.useBusyState();
|
||||
|
||||
// Todo: Implement other stores here.
|
||||
const { persist: persistStyling } = StylingHooks.useStore();
|
||||
const isBusy = false; // TODO: Implement loading state.
|
||||
|
||||
const handleSaveClick = () => {
|
||||
persistStyling();
|
||||
// Todo: Add other stores here.
|
||||
withActivity(
|
||||
'persist-styling',
|
||||
'Save styling details',
|
||||
persistStyling
|
||||
);
|
||||
};
|
||||
|
||||
const title = __( 'PayPal Payments', 'woocommerce-paypal-payments' );
|
||||
|
||||
return (
|
||||
<TopNavigation title={ title } exitOnTitleClick={ true }>
|
||||
<Button
|
||||
variant="primary"
|
||||
disabled={ isBusy }
|
||||
onClick={ handleSaveClick }
|
||||
>
|
||||
{ __( 'Save', 'woocommerce-paypal-payments' ) }
|
||||
</Button>
|
||||
<BusyStateWrapper>
|
||||
<Button variant="primary" onClick={ handleSaveClick }>
|
||||
{ __( 'Save', 'woocommerce-paypal-payments' ) }
|
||||
</Button>
|
||||
</BusyStateWrapper>
|
||||
</TopNavigation>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue