Server IP : 172.67.158.161 / Your IP : 18.116.14.111 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/thread-self/root/home/giankuin/sieuthiweb.com.vn/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/components/error-placeholder/ |
Upload File : |
/** * External dependencies */ import { __ } from '@wordpress/i18n'; import { Fragment } from '@wordpress/element'; import PropTypes from 'prop-types'; import { Icon, notice } from '@woocommerce/icons'; import classNames from 'classnames'; import { Button, Placeholder, Spinner } from '@wordpress/components'; /** * Internal dependencies */ import ErrorMessage from './error-message.js'; import './editor.scss'; const ErrorPlaceholder = ( { className, error, isLoading, onRetry } ) => ( <Placeholder icon={ <Icon srcElement={ notice } /> } label={ __( 'Sorry, an error occurred', 'woocommerce' ) } className={ classNames( 'wc-block-api-error', className ) } > <ErrorMessage error={ error } /> { onRetry && ( <Fragment> { isLoading ? ( <Spinner /> ) : ( <Button isDefault onClick={ onRetry }> { __( 'Retry', 'woocommerce' ) } </Button> ) } </Fragment> ) } </Placeholder> ); ErrorPlaceholder.propTypes = { /** * Classname to add to placeholder in addition to the defaults. */ className: PropTypes.string, /** * The error object. */ error: PropTypes.shape( { /** * Human-readable error message to display. */ message: PropTypes.node, /** * Context in which the error was triggered. That will determine how the error is displayed to the user. */ type: PropTypes.oneOf( [ 'api', 'general' ] ), } ), /** * Whether there is a request running, so the 'Retry' button is hidden and * a spinner is shown instead. */ isLoading: PropTypes.bool, /** * Callback to retry an action. */ onRetry: PropTypes.func, }; export default ErrorPlaceholder;