/**
* External dependencies
*/
import classnames from 'classnames';
import {
Disabled,
Button,
ButtonGroup,
PanelBody,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import {
AlignmentToolbar,
BlockControls,
useBlockProps,
InspectorControls,
} from '@wordpress/block-editor';
import type { BlockEditProps } from '@wordpress/blocks';
import { useEffect } from '@wordpress/element';
import { ProductQueryContext as Context } from '@woocommerce/blocks/product-query/types';
/**
* Internal dependencies
*/
import Block from './block';
import { BlockAttributes } from './types';
function WidthPanel( {
selectedWidth,
setAttributes,
}: {
selectedWidth: number | undefined;
setAttributes: ( attributes: BlockAttributes ) => void;
} ) {
function handleChange( newWidth: number ) {
// Check if we are toggling the width off
const width = selectedWidth === newWidth ? undefined : newWidth;
// Update attributes.
setAttributes( { width } );
}
return (