/** * External dependencies */ import { InspectorControls, useBlockProps } from '@wordpress/block-editor'; import type { ReactElement } from 'react'; import { formatPrice } from '@woocommerce/price-format'; import { PanelBody, ExternalLink, SelectControl, ToggleControl, } from '@wordpress/components'; import { getSetting } from '@woocommerce/settings'; import { __ } from '@wordpress/i18n'; import Noninteractive from '@woocommerce/base-components/noninteractive'; import { useTypographyProps } from '@woocommerce/base-hooks'; /** * Internal dependencies */ import QuantityBadge from './quantity-badge'; interface Attributes { addToCartBehaviour: string; hasHiddenPrice: boolean; } interface Props { attributes: Attributes; setAttributes: ( attributes: Record< string, unknown > ) => void; } const Edit = ( { attributes, setAttributes }: Props ): ReactElement => { const { addToCartBehaviour, hasHiddenPrice } = attributes; const blockProps = useBlockProps( { className: `wc-block-mini-cart`, } ); const templatePartEditUri = getSetting( 'templatePartEditUri', '' ) as string; const productCount = 0; const productTotal = 0; const typographyProps = useTypographyProps( attributes ); return (
{ setAttributes( { addToCartBehaviour: value } ); } } help={ __( 'Select what happens when a customer adds a product to the cart.', 'woo-gutenberg-products-block' ) } options={ [ { value: 'none', label: __( 'Do nothing', 'woo-gutenberg-products-block' ), }, { value: 'open_drawer', label: __( 'Open cart drawer', 'woo-gutenberg-products-block' ), }, ] } /> setAttributes( { hasHiddenPrice: ! hasHiddenPrice, } ) } /> { templatePartEditUri && (

{ __( 'Edit the appearance of the Mini Cart.', 'woo-gutenberg-products-block' ) }

{ __( 'Edit Mini Cart template part', 'woo-gutenberg-products-block' ) }
) }
); }; export default Edit;