2020-05-27 14:45:18 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __ } from '@wordpress/i18n';
|
2022-02-01 16:54:38 +00:00
|
|
|
import { Icon, mediaAndText } from '@wordpress/icons';
|
2020-05-29 11:28:04 +00:00
|
|
|
import { getBlockMap } from '@woocommerce/atomic-utils';
|
2020-05-27 14:45:18 +00:00
|
|
|
|
|
|
|
export const BLOCK_NAME = 'woocommerce/single-product';
|
|
|
|
export const BLOCK_TITLE = __(
|
|
|
|
'Single Product',
|
|
|
|
'woo-gutenberg-products-block'
|
|
|
|
);
|
2021-12-10 14:32:44 +00:00
|
|
|
export const BLOCK_ICON = (
|
|
|
|
<Icon
|
2022-02-01 16:54:38 +00:00
|
|
|
icon={ mediaAndText }
|
2021-12-10 14:32:44 +00:00
|
|
|
className="wc-block-editor-components-block-icon"
|
|
|
|
/>
|
|
|
|
);
|
2020-05-27 14:45:18 +00:00
|
|
|
export const BLOCK_DESCRIPTION = __(
|
|
|
|
'Display a single product.',
|
|
|
|
'woo-gutenberg-products-block'
|
|
|
|
);
|
2020-05-29 11:28:04 +00:00
|
|
|
|
|
|
|
export const DEFAULT_INNER_BLOCKS = [
|
|
|
|
[
|
|
|
|
'core/columns',
|
|
|
|
{},
|
|
|
|
[
|
|
|
|
[
|
|
|
|
'core/column',
|
|
|
|
{},
|
|
|
|
[ [ 'woocommerce/product-image', { showSaleBadge: false } ] ],
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'core/column',
|
|
|
|
{},
|
|
|
|
[
|
|
|
|
[ 'woocommerce/product-sale-badge' ],
|
2020-07-21 13:27:41 +00:00
|
|
|
[ 'woocommerce/product-title', { headingLevel: 2 } ],
|
2020-05-29 11:28:04 +00:00
|
|
|
[ 'woocommerce/product-rating' ],
|
|
|
|
[ 'woocommerce/product-price' ],
|
|
|
|
[ 'woocommerce/product-summary' ],
|
2020-06-11 09:02:00 +00:00
|
|
|
[ 'woocommerce/product-stock-indicator' ],
|
2020-06-17 09:52:03 +00:00
|
|
|
[
|
|
|
|
'woocommerce/product-add-to-cart',
|
|
|
|
{ showFormElements: true },
|
|
|
|
],
|
2020-06-05 14:36:07 +00:00
|
|
|
[ 'woocommerce/product-sku' ],
|
2020-06-10 15:56:13 +00:00
|
|
|
[ 'woocommerce/product-category-list' ],
|
|
|
|
[ 'woocommerce/product-tag-list' ],
|
2020-05-29 11:28:04 +00:00
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
];
|
|
|
|
|
|
|
|
export const ALLOWED_INNER_BLOCKS = [
|
|
|
|
'core/columns',
|
|
|
|
'core/column',
|
|
|
|
...Object.keys( getBlockMap( BLOCK_NAME ) ),
|
|
|
|
];
|