From 08ec9fa80347c80b3882923838aeb10c7fc69ee4 Mon Sep 17 00:00:00 2001 From: Tiago Noronha Date: Thu, 5 Apr 2018 17:19:36 +0100 Subject: [PATCH] Closes woocommerce/woocommerce-blocks#59: Individual products - remove rows slider --- .../assets/js/products-block.js | 24 ++++++++++++------- .../assets/js/products-block.jsx | 16 +++++++++---- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/plugins/woocommerce-blocks/assets/js/products-block.js b/plugins/woocommerce-blocks/assets/js/products-block.js index 62718d06c31..fc0b4eedfab 100644 --- a/plugins/woocommerce-blocks/assets/js/products-block.js +++ b/plugins/woocommerce-blocks/assets/js/products-block.js @@ -785,6 +785,20 @@ registerBlockType('woocommerce/products', { }); } + // Row settings don't make sense for specific-selected products display. + var rowControl = null; + if ('specific' !== display) { + rowControl = wp.element.createElement(RangeControl, { + label: __('Rows'), + value: rows, + onChange: function onChange(value) { + return setAttributes({ rows: value }); + }, + min: 1, + max: 6 + }); + } + return wp.element.createElement( InspectorControls, { key: 'inspector' }, @@ -794,15 +808,7 @@ registerBlockType('woocommerce/products', { __('Layout') ), columnControl, - wp.element.createElement(RangeControl, { - label: __('Rows'), - value: rows, - onChange: function onChange(value) { - return setAttributes({ rows: value }); - }, - min: 1, - max: 6 - }), + rowControl, orderControl ); }; diff --git a/plugins/woocommerce-blocks/assets/js/products-block.jsx b/plugins/woocommerce-blocks/assets/js/products-block.jsx index 6b77603a8fd..869b5861ea2 100644 --- a/plugins/woocommerce-blocks/assets/js/products-block.jsx +++ b/plugins/woocommerce-blocks/assets/js/products-block.jsx @@ -525,10 +525,10 @@ registerBlockType( 'woocommerce/products', { ); } - return ( - -

{ __( 'Layout' ) }

- { columnControl } + // Row settings don't make sense for specific-selected products display. + let rowControl = null; + if ( 'specific' !== display ) { + rowControl = ( + ); + } + + return ( + +

{ __( 'Layout' ) }

+ { columnControl } + { rowControl } { orderControl }
);