Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/block-library/src/spacer/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useInstanceId } from '@wordpress/compose';
/**
* Internal dependencies
*/
import { MAX_SPACER_SIZE } from './edit';
import { MIN_SPACER_SIZE } from './edit';

function DimensionInput( { label, onChange, isResizing, value = '' } ) {
const inputId = useInstanceId( UnitControl, 'block-spacer-height-input' );
Expand Down Expand Up @@ -56,8 +56,7 @@ function DimensionInput( { label, onChange, isResizing, value = '' } ) {
<UnitControl
id={ inputId }
isResetValueOnUnitChange
min={ 0 }
max={ MAX_SPACER_SIZE }
min={ MIN_SPACER_SIZE }
onChange={ handleOnChange }
style={ { maxWidth: 80 } }
value={ computedValue }
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/spacer/controls.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import { MIN_SPACER_SIZE } from './edit';
import styles from './style.scss';

const DEFAULT_VALUES = { px: 100, em: 10, rem: 10, vw: 10, vh: 25 };
Expand Down Expand Up @@ -66,7 +67,7 @@ function Controls( { attributes, context, setAttributes } ) {
<PanelBody title={ __( 'Dimensions' ) }>
<UnitControl
label={ label }
min={ 1 }
min={ MIN_SPACER_SIZE }
value={ value }
onChange={ handleChange }
onUnitChange={ handleUnitChange }
Expand Down
9 changes: 3 additions & 6 deletions packages/block-library/src/spacer/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import { View } from '@wordpress/primitives';
*/
import SpacerControls from './controls';

export const MIN_SPACER_SIZE = 1;
export const MAX_SPACER_SIZE = 500;
export const MIN_SPACER_SIZE = 0;

const ResizableSpacer = ( {
orientation,
Expand Down Expand Up @@ -58,10 +57,7 @@ const ResizableSpacer = ( {
}
} }
onResizeStop={ ( _event, _direction, elt ) => {
const nextVal = Math.min(
MAX_SPACER_SIZE,
getCurrentSize( elt )
);
const nextVal = getCurrentSize( elt );
onResizeStop( `${ nextVal }px` );
setIsResizing( false );
} }
Expand Down Expand Up @@ -147,6 +143,7 @@ const SpacerEdit = ( {
return (
<>
<ResizableSpacer
minHeight={ MIN_SPACER_SIZE }
enable={ {
top: false,
right: false,
Expand Down