2021-08-25 15:42:55 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __ } from '@wordpress/i18n';
|
2022-02-01 16:54:38 +00:00
|
|
|
import { cart } from '@woocommerce/icons';
|
|
|
|
import { Icon } from '@wordpress/icons';
|
2022-04-08 13:47:19 +00:00
|
|
|
import { registerBlockType } from '@wordpress/blocks';
|
|
|
|
import type { BlockConfiguration } from '@wordpress/blocks';
|
2021-08-25 15:42:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import edit from './edit';
|
|
|
|
|
2022-04-08 08:51:21 +00:00
|
|
|
const settings: BlockConfiguration = {
|
2021-08-25 15:42:55 +00:00
|
|
|
apiVersion: 2,
|
|
|
|
title: __( 'Mini Cart', 'woo-gutenberg-products-block' ),
|
|
|
|
icon: {
|
2021-12-10 14:32:44 +00:00
|
|
|
src: (
|
|
|
|
<Icon
|
2022-02-01 16:54:38 +00:00
|
|
|
icon={ cart }
|
2021-12-10 14:32:44 +00:00
|
|
|
className="wc-block-editor-components-block-icon"
|
|
|
|
/>
|
|
|
|
),
|
2021-08-25 15:42:55 +00:00
|
|
|
},
|
|
|
|
category: 'woocommerce',
|
|
|
|
keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
|
|
|
|
description: __(
|
|
|
|
'Display a mini cart widget.',
|
|
|
|
'woo-gutenberg-products-block'
|
|
|
|
),
|
|
|
|
supports: {
|
|
|
|
html: false,
|
|
|
|
multiple: false,
|
2022-03-09 09:13:52 +00:00
|
|
|
color: true,
|
2021-08-25 15:42:55 +00:00
|
|
|
},
|
|
|
|
example: {
|
|
|
|
attributes: {
|
|
|
|
isPreview: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
attributes: {
|
|
|
|
isPreview: {
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
save: false,
|
|
|
|
},
|
2022-03-26 00:32:23 +00:00
|
|
|
addToCartBehaviour: {
|
|
|
|
type: 'string',
|
|
|
|
default: 'none',
|
|
|
|
},
|
2021-08-25 15:42:55 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
edit,
|
|
|
|
|
|
|
|
save() {
|
|
|
|
return null;
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2022-04-08 08:51:21 +00:00
|
|
|
registerBlockType( 'woocommerce/mini-cart', settings );
|