/** * External dependencies */ import { __ } from '@wordpress/i18n'; import { WC_BLOCKS_IMAGE_URL } from '@woocommerce/block-settings'; /** * Internal dependencies */ import type { BlockErrorProps } from './types'; const BlockError = ( { imageUrl = `${ WC_BLOCKS_IMAGE_URL }/block-error.svg`, header = __( 'Oops!', 'woo-gutenberg-products-block' ), text = __( 'There was an error loading the content.', 'woo-gutenberg-products-block' ), errorMessage, errorMessagePrefix = __( 'Error:', 'woo-gutenberg-products-block' ), button, showErrorBlock = true, }: BlockErrorProps ): React.ReactNode => { return showErrorBlock ? (
{ imageUrl && ( ) }
{ header && (

{ header }

) } { text && (

{ text }

) } { errorMessage && (

{ errorMessagePrefix ? errorMessagePrefix + ' ' : '' } { errorMessage }

) } { button && (

{ button }

) }
) : null; }; export default BlockError;