2021-08-25 15:42:55 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __ } from '@wordpress/i18n';
|
|
|
|
import { Icon, cart } from '@woocommerce/icons';
|
2021-09-16 18:50:33 +00:00
|
|
|
import { registerExperimentalBlockType } from '@woocommerce/block-settings';
|
2021-08-25 15:42:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import edit from './edit';
|
|
|
|
|
|
|
|
const settings = {
|
|
|
|
apiVersion: 2,
|
|
|
|
title: __( 'Mini Cart', 'woo-gutenberg-products-block' ),
|
|
|
|
icon: {
|
2021-12-10 14:32:44 +00:00
|
|
|
src: (
|
|
|
|
<Icon
|
|
|
|
srcElement={ cart }
|
|
|
|
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,
|
2021-11-17 15:39:07 +00:00
|
|
|
color: {
|
|
|
|
/**
|
|
|
|
* Because we don't target the wrapper element, we don't need
|
|
|
|
* to add color classes and style to the wrapper.
|
|
|
|
*/
|
|
|
|
__experimentalSkipSerialization: true,
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* We need this experimental flag because we don't want to style the
|
|
|
|
* wrapper but inner elements.
|
|
|
|
*/
|
|
|
|
__experimentalSelector:
|
|
|
|
'.wc-block-mini-cart__button, .wc-block-mini-cart__badge',
|
2021-08-25 15:42:55 +00:00
|
|
|
},
|
|
|
|
example: {
|
|
|
|
attributes: {
|
|
|
|
isPreview: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
attributes: {
|
2021-11-22 23:40:24 +00:00
|
|
|
align: {
|
|
|
|
type: 'string',
|
|
|
|
default: 'right',
|
|
|
|
},
|
2021-08-25 15:42:55 +00:00
|
|
|
isPreview: {
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
save: false,
|
|
|
|
},
|
2021-11-17 15:39:07 +00:00
|
|
|
transparentButton: {
|
|
|
|
type: 'boolean',
|
|
|
|
default: true,
|
|
|
|
},
|
2021-08-25 15:42:55 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
edit,
|
|
|
|
|
|
|
|
save() {
|
|
|
|
return null;
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2021-09-16 18:50:33 +00:00
|
|
|
registerExperimentalBlockType( 'woocommerce/mini-cart', settings );
|