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( return wp.element.createElement(
InspectorControls, InspectorControls,
{ key: 'inspector' }, { key: 'inspector' },
@ -794,15 +808,7 @@ registerBlockType('woocommerce/products', {
__('Layout') __('Layout')
), ),
columnControl, columnControl,
wp.element.createElement(RangeControl, { rowControl,
label: __('Rows'),
value: rows,
onChange: function onChange(value) {
return setAttributes({ rows: value });
},
min: 1,
max: 6
}),
orderControl orderControl
); );
}; };

View File

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