fix/8946: replace ToggleGroupControl with ToggleControl (https://github.com/woocommerce/woocommerce-blocks/pull/9098)

* replace ToggleGroupControl with ToggleControl

* eslint fix

* Fix linting in assets/js/mini-cart/edit.tsx file

---------

Co-authored-by: Niels Lange <info@nielslange.de>
Co-authored-by: Karol Manijak <karol.manijak@automattic.com>
This commit is contained in:
Siddharth Thevaril 2023-04-19 21:15:48 +05:30 committed by GitHub
parent 022e532688
commit 50f08e6143
1 changed files with 16 additions and 19 deletions

View File

@ -7,6 +7,7 @@ import {
PanelBody, PanelBody,
ExternalLink, ExternalLink,
ToggleControl, ToggleControl,
BaseControl,
__experimentalToggleGroupControlOption as ToggleGroupControlOption, __experimentalToggleGroupControlOption as ToggleGroupControlOption,
__experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControl as ToggleGroupControl,
} from '@wordpress/components'; } from '@wordpress/components';
@ -58,36 +59,32 @@ const Edit = ( { attributes, setAttributes }: Props ): ReactElement => {
'woo-gutenberg-products-block' 'woo-gutenberg-products-block'
) } ) }
> >
<ToggleGroupControl <BaseControl
className="wc-block-mini-cart__add-to-cart-behaviour-toggle" id="wc-block-mini-cart__add-to-cart-behaviour-toggle"
label={ __( label={ __(
'Add-to-Cart behaviour', 'Add-to-Cart behaviour',
'woo-gutenberg-products-block' 'woo-gutenberg-products-block'
) } ) }
value={ addToCartBehaviour } >
<ToggleControl
label={ __(
'Open cart in a drawer',
'woo-gutenberg-products-block'
) }
onChange={ ( value ) => { onChange={ ( value ) => {
setAttributes( { addToCartBehaviour: value } ); setAttributes( {
addToCartBehaviour: value
? 'open_drawer'
: 'none',
} );
} } } }
help={ __( help={ __(
'Select what happens when a customer adds a product to the cart.', 'Select what happens when a customer adds a product to the cart.',
'woo-gutenberg-products-block' 'woo-gutenberg-products-block'
) } ) }
> checked={ addToCartBehaviour === 'open_drawer' }
<ToggleGroupControlOption
value="none"
label={ __(
'Do nothing',
'woo-gutenberg-products-block'
) }
/> />
<ToggleGroupControlOption </BaseControl>
value="open_drawer"
label={ __(
'Open cart drawer',
'woo-gutenberg-products-block'
) }
/>
</ToggleGroupControl>
<ToggleControl <ToggleControl
label={ __( label={ __(
'Hide Cart Price', 'Hide Cart Price',