@@ -17,6 +17,8 @@ import Noninteractive from '@woocommerce/base-components/noninteractive';
1717import { isSiteEditorPage } from '@woocommerce/utils' ;
1818import type { ReactElement } from 'react' ;
1919import { select } from '@wordpress/data' ;
20+ import { cartOutline , bag , bagAlt } from '@woocommerce/icons' ;
21+ import { Icon } from '@wordpress/icons' ;
2022
2123/**
2224 * Internal dependencies
@@ -25,6 +27,7 @@ import QuantityBadge from './quantity-badge';
2527import './editor.scss' ;
2628
2729interface Attributes {
30+ miniCartIcon : 'cart' | 'bag' | 'bag-alt' ;
2831 addToCartBehaviour : string ;
2932 hasHiddenPrice : boolean ;
3033 cartAndCheckoutRenderStyle : boolean ;
@@ -36,8 +39,12 @@ interface Props {
3639}
3740
3841const Edit = ( { attributes, setAttributes } : Props ) : ReactElement => {
39- const { addToCartBehaviour, hasHiddenPrice, cartAndCheckoutRenderStyle } =
40- attributes ;
42+ const {
43+ miniCartIcon,
44+ addToCartBehaviour,
45+ hasHiddenPrice,
46+ cartAndCheckoutRenderStyle,
47+ } = attributes ;
4148 const blockProps = useBlockProps ( {
4249 className : `wc-block-mini-cart` ,
4350 } ) ;
@@ -58,22 +65,57 @@ const Edit = ( { attributes, setAttributes }: Props ): ReactElement => {
5865 < PanelBody
5966 title = { __ ( 'Settings' , 'woo-gutenberg-products-block' ) }
6067 >
61- < ToggleControl
68+ < ToggleGroupControl
69+ className = "wc-block-editor-mini-cart__cart-icon-toggle"
70+ isBlock = { true }
6271 label = { __ (
63- 'Display total price ' ,
72+ 'Cart Icon ' ,
6473 'woo-gutenberg-products-block'
6574 ) }
66- help = { __ (
67- 'Toggle to display the total price of products in the shopping cart. If no products have been added, the price will not display.' ,
75+ value = { miniCartIcon }
76+ onChange = { ( value ) => {
77+ setAttributes ( {
78+ miniCartIcon : value ,
79+ } ) ;
80+ } }
81+ >
82+ < ToggleGroupControlOption
83+ value = { 'cart' }
84+ label = { < Icon size = { 32 } icon = { cartOutline } /> }
85+ />
86+ < ToggleGroupControlOption
87+ value = { 'bag' }
88+ label = { < Icon size = { 32 } icon = { bag } /> }
89+ />
90+ < ToggleGroupControlOption
91+ value = { 'bag-alt' }
92+ label = { < Icon size = { 32 } icon = { bagAlt } /> }
93+ />
94+ </ ToggleGroupControl >
95+ < BaseControl
96+ id = "wc-block-mini-cart__display-toggle"
97+ label = { __ (
98+ 'Display' ,
6899 'woo-gutenberg-products-block'
69100 ) }
70- checked = { ! hasHiddenPrice }
71- onChange = { ( ) =>
72- setAttributes ( {
73- hasHiddenPrice : ! hasHiddenPrice ,
74- } )
75- }
76- />
101+ >
102+ < ToggleControl
103+ label = { __ (
104+ 'Display total price' ,
105+ 'woo-gutenberg-products-block'
106+ ) }
107+ help = { __ (
108+ 'Toggle to display the total price of products in the shopping cart. If no products have been added, the price will not display.' ,
109+ 'woo-gutenberg-products-block'
110+ ) }
111+ checked = { ! hasHiddenPrice }
112+ onChange = { ( ) =>
113+ setAttributes ( {
114+ hasHiddenPrice : ! hasHiddenPrice ,
115+ } )
116+ }
117+ />
118+ </ BaseControl >
77119 { isSiteEditor && (
78120 < ToggleGroupControl
79121 className = "wc-block-editor-mini-cart__render-in-cart-and-checkout-toggle"
@@ -177,7 +219,10 @@ const Edit = ( { attributes, setAttributes }: Props ): ReactElement => {
177219 { formatPrice ( productTotal ) }
178220 </ span >
179221 ) }
180- < QuantityBadge count = { productCount } />
222+ < QuantityBadge
223+ count = { productCount }
224+ icon = { miniCartIcon }
225+ />
181226 </ button >
182227 </ Noninteractive >
183228 </ div >
0 commit comments