ensure function is not re-created unnecessarily. (https://github.com/woocommerce/woocommerce-blocks/pull/1093)

This commit is contained in:
Darren Ethier 2019-10-28 08:44:25 -04:00 committed by GitHub
parent 6319de52e9
commit dee8dcb296
1 changed files with 17 additions and 15 deletions

View File

@ -13,6 +13,22 @@ import { IconFolder } from '@woocommerce/block-components/icons';
*/
import ToggleButtonControl from '@woocommerce/block-components/toggle-button-control';
const EmptyPlaceHolder = () => (
<Placeholder
icon={ <IconFolder /> }
label={ __(
'Product Categories List',
'woo-gutenberg-products-block'
) }
className="wc-block-product-categories"
>
{ __(
"This block shows product categories for your store. To use it, you'll first need to create a product and assign it to a category.",
'woo-gutenberg-products-block'
) }
</Placeholder>
);
/**
* Component displaying the categories as dropdown or list.
*/
@ -138,21 +154,7 @@ const ProductCategoriesBlock = ( { attributes, setAttributes, name } ) => {
<ServerSideRender
block={ name }
attributes={ attributes }
EmptyResponsePlaceholder={ () => (
<Placeholder
icon={ <IconFolder /> }
label={ __(
'Product Categories List',
'woo-gutenberg-products-block'
) }
className="wc-block-product-categories"
>
{ __(
"This block shows product categories for your store. To use it, you'll first need to create a product and assign it to a category.",
'woo-gutenberg-products-block'
) }
</Placeholder>
) }
EmptyResponsePlaceholder={ EmptyPlaceHolder }
/>
</Fragment>
);