Skip to content

Commit

Permalink
Move min height into the dimensions block support panel
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw committed Aug 13, 2021
1 parent ab8a037 commit ff6ca6f
Showing 1 changed file with 31 additions and 14 deletions.
45 changes: 31 additions & 14 deletions packages/block-library/src/cover/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ import {
withNotices,
__experimentalUseCustomUnits as useCustomUnits,
__experimentalBoxControl as BoxControl,
__experimentalToolsPanelItem as ToolsPanelItem,
} from '@wordpress/components';
import { compose, withInstanceId, useInstanceId } from '@wordpress/compose';
import {
BlockControls,
BlockIcon,
DimensionControls,
InspectorControls,
MediaPlaceholder,
MediaReplaceFlow,
Expand Down Expand Up @@ -512,20 +514,6 @@ function CoverEdit( {
</PanelRow>
</PanelBody>
) }
<PanelBody title={ __( 'Dimensions' ) }>
<CoverHeightInput
value={ temporaryMinHeight || minHeight }
unit={ minHeightUnit }
onChange={ ( newMinHeight ) =>
setAttributes( { minHeight: newMinHeight } )
}
onUnitChange={ ( nextUnit ) =>
setAttributes( {
minHeightUnit: nextUnit,
} )
}
/>
</PanelBody>
<PanelColorGradientSettings
title={ __( 'Overlay' ) }
initialOpen={ true }
Expand Down Expand Up @@ -556,6 +544,35 @@ function CoverEdit( {
) }
</PanelColorGradientSettings>
</InspectorControls>
<DimensionControls>
<ToolsPanelItem
hasValue={ () => !! minHeight }
label={ __( 'Minimum height' ) }
onDeselect={ () =>
setAttributes( { minHeight: undefined } )
}
resetAllFilter={ ( newAttributes ) => {
return {
...newAttributes,
minHeight: undefined,
};
} }
isShownByDefault={ true }
>
<CoverHeightInput
value={ temporaryMinHeight || minHeight }
unit={ minHeightUnit }
onChange={ ( newMinHeight ) =>
setAttributes( { minHeight: newMinHeight } )
}
onUnitChange={ ( nextUnit ) =>
setAttributes( {
minHeightUnit: nextUnit,
} )
}
/>
</ToolsPanelItem>
</DimensionControls>
</>
);

Expand Down

0 comments on commit ff6ca6f

Please sign in to comment.