Closes woocommerce/woocommerce-blocks#59: Individual products - remove rows slider

This commit is contained in:
Tiago Noronha 2018-04-05 17:19:36 +01:00
parent 710e8d03eb
commit 08ec9fa803
2 changed files with 27 additions and 13 deletions

View File

@ -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
);
};

View File

@ -525,10 +525,10 @@ registerBlockType( 'woocommerce/products', {
);
}
return (
<InspectorControls key="inspector">
<h3>{ __( 'Layout' ) }</h3>
{ columnControl }
// Row settings don't make sense for specific-selected products display.
let rowControl = null;
if ( 'specific' !== display ) {
rowControl = (
<RangeControl
label={ __( 'Rows' ) }
value={ rows }
@ -536,6 +536,14 @@ registerBlockType( 'woocommerce/products', {
min={ 1 }
max={ 6 }
/>
);
}
return (
<InspectorControls key="inspector">
<h3>{ __( 'Layout' ) }</h3>
{ columnControl }
{ rowControl }
{ orderControl }
</InspectorControls>
);