/** * External dependencies */ import { __ } from '@wordpress/i18n'; import { Fragment } from '@wordpress/element'; import PropTypes from 'prop-types'; import { ToggleControl } from '@wordpress/components'; /** * A combination of toggle controls for content visibility in product grids. */ const GridContentControl = ( { onChange, settings } ) => { const { button, price, rating, title } = settings; return ( onChange( { ...settings, title: ! title } ) } /> onChange( { ...settings, price: ! price } ) } /> onChange( { ...settings, rating: ! rating } ) } /> onChange( { ...settings, button: ! button } ) } /> ); }; GridContentControl.propTypes = { /** * The current title visibility. */ settings: PropTypes.shape( { button: PropTypes.bool.isRequired, price: PropTypes.bool.isRequired, rating: PropTypes.bool.isRequired, title: PropTypes.bool.isRequired, } ).isRequired, /** * Callback to update the layout settings. */ onChange: PropTypes.func.isRequired, }; export default GridContentControl;