/** * External dependencies */ import { BlockControls } from '@wordpress/block-editor'; import { Toolbar } from '@wordpress/components'; import { useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import TextToolbarButton from '@woocommerce/block-components/text-toolbar-button'; import PropTypes from 'prop-types'; /** * Internal dependencies */ import FullCart from './full-cart'; import EmptyCart from './empty-cart'; /** * Component to handle edit mode of "Cart Block". */ const CartEditor = ( { className } ) => { const [ isFullCartMode, setFullCartMode ] = useState( true ); const toggleFullCartMode = () => { setFullCartMode( ! isFullCartMode ); }; const getBlockControls = () => { return ( { __( 'Full Cart', 'woo-gutenberg-products-block' ) } { __( 'Empty Cart', 'woo-gutenberg-products-block' ) } ); }; return (
{ getBlockControls() } { isFullCartMode && }
); }; CartEditor.propTypes = { className: PropTypes.string, }; export default CartEditor;