2021-11-19 11:47:48 +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 08:51:21 +00:00
|
|
|
import { registerBlockType, BlockConfiguration } from '@wordpress/blocks';
|
2021-11-19 11:47:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2021-12-07 14:07:53 +00:00
|
|
|
import edit, { Save as save } from './edit';
|
2021-12-10 11:11:59 +00:00
|
|
|
import { blockName } from './attributes';
|
2021-12-07 14:07:53 +00:00
|
|
|
import './inner-blocks';
|
2021-11-19 11:47:48 +00:00
|
|
|
|
2022-04-08 08:51:21 +00:00
|
|
|
const settings: BlockConfiguration = {
|
2021-11-19 11:47:48 +00:00
|
|
|
apiVersion: 2,
|
|
|
|
title: __( 'Mini Cart Contents', '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-11-19 11:47:48 +00:00
|
|
|
},
|
|
|
|
category: 'woocommerce',
|
|
|
|
keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
|
|
|
|
description: __(
|
|
|
|
'Display a mini cart widget.',
|
|
|
|
'woo-gutenberg-products-block'
|
|
|
|
),
|
|
|
|
supports: {
|
|
|
|
align: false,
|
|
|
|
html: false,
|
|
|
|
multiple: false,
|
|
|
|
reusable: false,
|
|
|
|
inserter: false,
|
2021-12-20 07:57:55 +00:00
|
|
|
color: {
|
2022-01-21 17:39:04 +00:00
|
|
|
link: true,
|
2021-12-20 07:57:55 +00:00
|
|
|
},
|
2021-11-19 11:47:48 +00:00
|
|
|
},
|
|
|
|
attributes: {
|
2021-12-10 11:11:59 +00:00
|
|
|
isPreview: {
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
save: false,
|
|
|
|
},
|
2021-11-19 11:47:48 +00:00
|
|
|
lock: {
|
|
|
|
type: 'object',
|
|
|
|
default: {
|
|
|
|
remove: true,
|
|
|
|
move: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
example: {
|
|
|
|
attributes: {
|
|
|
|
isPreview: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
edit,
|
2021-12-07 14:07:53 +00:00
|
|
|
save,
|
2021-11-19 11:47:48 +00:00
|
|
|
};
|
|
|
|
|
2022-04-08 08:51:21 +00:00
|
|
|
registerBlockType( blockName, settings );
|