Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

fix/8946: replace ToggleGroupControl with ToggleControl #9098

Merged
merged 4 commits into from
Apr 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 16 additions & 19 deletions assets/js/blocks/mini-cart/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
PanelBody,
ExternalLink,
ToggleControl,
BaseControl,
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
__experimentalToggleGroupControl as ToggleGroupControl,
} from '@wordpress/components';
Expand Down Expand Up @@ -58,36 +59,32 @@ const Edit = ( { attributes, setAttributes }: Props ): ReactElement => {
'woo-gutenberg-products-block'
) }
>
<ToggleGroupControl
className="wc-block-mini-cart__add-to-cart-behaviour-toggle"
<BaseControl
id="wc-block-mini-cart__add-to-cart-behaviour-toggle"
label={ __(
'Add-to-Cart behaviour',
'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
value="none"
<ToggleControl
label={ __(
'Do nothing',
'Open cart in a drawer',
'woo-gutenberg-products-block'
) }
/>
<ToggleGroupControlOption
value="open_drawer"
label={ __(
'Open cart drawer',
onChange={ ( value ) => {
setAttributes( {
addToCartBehaviour: value
? 'open_drawer'
: 'none',
} );
} }
help={ __(
'Select what happens when a customer adds a product to the cart.',
'woo-gutenberg-products-block'
) }
checked={ addToCartBehaviour === 'open_drawer' }
/>
</ToggleGroupControl>
</BaseControl>
<ToggleControl
label={ __(
'Hide Cart Price',
Expand Down