/** * External dependencies */ import { __ } from '@wordpress/i18n'; import { InspectorControls } from '@wordpress/editor'; import { PanelBody, ToggleControl } from '@wordpress/components'; import { Fragment } from '@wordpress/element'; import PropTypes from 'prop-types'; /** * Internal dependencies */ import { IconAllReviews } from '@woocommerce/block-components/icons'; import EditorContainerBlock from '../editor-container-block.js'; import NoReviewsPlaceholder from './no-reviews-placeholder.js'; import { getSharedReviewContentControls, getSharedReviewListControls, } from '../edit-utils.js'; /** * Component to handle edit mode of "All Reviews". */ const AllReviewsEditor = ( { attributes, setAttributes } ) => { const getInspectorControls = () => { return ( setAttributes( { showProductName: ! attributes.showProductName, } ) } /> { getSharedReviewContentControls( attributes, setAttributes ) } { getSharedReviewListControls( attributes, setAttributes ) } ); }; return ( { getInspectorControls() } } name={ __( 'All Reviews', 'woo-gutenberg-products-block' ) } noReviewsPlaceholder={ NoReviewsPlaceholder } /> ); }; AllReviewsEditor.propTypes = { /** * The attributes for this block. */ attributes: PropTypes.object.isRequired, /** * The register block name. */ name: PropTypes.string.isRequired, /** * A callback to update attributes. */ setAttributes: PropTypes.func.isRequired, }; export default AllReviewsEditor;