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 }
onChange={ ( value ) => {
setAttributes( { addToCartBehaviour: value } );
} }
help={ __(
'Select what happens when a customer adds a product to the cart.',
'woo-gutenberg-products-block'
) }
> >
<ToggleGroupControlOption <ToggleControl
value="none"
label={ __( label={ __(
'Do nothing', 'Open cart in a drawer',
'woo-gutenberg-products-block' 'woo-gutenberg-products-block'
) } ) }
/> onChange={ ( value ) => {
<ToggleGroupControlOption setAttributes( {
value="open_drawer" addToCartBehaviour: value
label={ __( ? 'open_drawer'
'Open cart drawer', : 'none',
} );
} }
help={ __(
'Select what happens when a customer adds a product to the cart.',
'woo-gutenberg-products-block' 'woo-gutenberg-products-block'
) } ) }
checked={ addToCartBehaviour === 'open_drawer' }
/> />
</ToggleGroupControl> </BaseControl>
<ToggleControl <ToggleControl
label={ __( label={ __(
'Hide Cart Price', 'Hide Cart Price',