47 lines
945 B
JavaScript
47 lines
945 B
JavaScript
/**
|
|
* External dependencies
|
|
*/
|
|
import { __ } from '@wordpress/i18n';
|
|
import { InnerBlocks } from '@wordpress/editor';
|
|
import { registerBlockType } from '@wordpress/blocks';
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
import Block from './block';
|
|
import { example } from './example';
|
|
|
|
/**
|
|
* Register and run the Cart block.
|
|
*/
|
|
registerBlockType( 'woocommerce/cart', {
|
|
title: __( 'Cart', 'woo-gutenberg-products-block' ),
|
|
icon: {
|
|
src: 'cart',
|
|
foreground: '#96588a',
|
|
},
|
|
category: 'woocommerce',
|
|
keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
|
|
description: __( 'Shopping cart.', 'woo-gutenberg-products-block' ),
|
|
supports: {
|
|
align: [ 'wide', 'full' ],
|
|
html: false,
|
|
},
|
|
example,
|
|
attributes: {},
|
|
|
|
/**
|
|
* Renders and manages the block.
|
|
*/
|
|
edit( props ) {
|
|
return <Block { ...props } />;
|
|
},
|
|
|
|
/**
|
|
* Block content is rendered in PHP, not via save function.
|
|
*/
|
|
save() {
|
|
return <InnerBlocks.Content />;
|
|
},
|
|
} );
|