mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-08 21:52:55 +08:00
👁️🗨️ Enhance the accessibility of the new Settings UI
This commit is contained in:
parent
244de6050b
commit
bf2346d33d
14 changed files with 268 additions and 58 deletions
|
@ -2,20 +2,24 @@ import { __ } from '@wordpress/i18n';
|
|||
import { Spinner } from '@wordpress/components';
|
||||
import classnames from 'classnames';
|
||||
|
||||
const SpinnerOverlay = ( { asModal = false, message = null } ) => {
|
||||
/**
|
||||
* Renders a loading spinner.
|
||||
*
|
||||
* @param {Object} props Component properties.
|
||||
* @param {boolean} [props.asModal=false] Whether to display the spinner as a modal overlay.
|
||||
* @param {string} [props.ariaLabel] Accessible label for screen readers.
|
||||
* @return {JSX.Element} The spinner overlay component.
|
||||
*/
|
||||
const SpinnerOverlay = ( {
|
||||
asModal = false,
|
||||
ariaLabel = __( 'Loading…', 'woocommerce-paypal-payments' ),
|
||||
} ) => {
|
||||
const className = classnames( 'ppcp-r-spinner-overlay', {
|
||||
'ppcp--is-modal': asModal,
|
||||
} );
|
||||
|
||||
if ( null === message ) {
|
||||
message = __( 'Loading…', 'woocommerce-paypal-payments' );
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={ className }>
|
||||
{ message && (
|
||||
<span className="ppcp--spinner-message">{ message }</span>
|
||||
) }
|
||||
<div className={ className } role="status" aria-label={ ariaLabel }>
|
||||
<Spinner />
|
||||
</div>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue