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 20, 2021
1 parent 515f33d commit 504dc9d
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions packages/block-library/src/cover/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
withNotices,
__experimentalUseCustomUnits as useCustomUnits,
__experimentalBoxControl as BoxControl,
__experimentalToolsPanelItem as ToolsPanelItem,
} from '@wordpress/components';
import { compose, withInstanceId, useInstanceId } from '@wordpress/compose';
import {
Expand Down Expand Up @@ -536,20 +537,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 @@ -580,6 +567,30 @@ function CoverEdit( {
) }
</PanelColorGradientSettings>
</InspectorControls>
<InspectorControls __experimentalGroup="dimensions">
<ToolsPanelItem
hasValue={ () => !! minHeight }
label={ __( 'Minimum height' ) }
onDeselect={ () =>
setAttributes( { minHeight: undefined } )
}
resetAllFilter={ () => ( { minHeight: undefined } ) }
isShownByDefault={ true }
>
<CoverHeightInput
value={ temporaryMinHeight || minHeight }
unit={ minHeightUnit }
onChange={ ( newMinHeight ) =>
setAttributes( { minHeight: newMinHeight } )
}
onUnitChange={ ( nextUnit ) =>
setAttributes( {
minHeightUnit: nextUnit,
} )
}
/>
</ToolsPanelItem>
</InspectorControls>
</>
);

Expand Down

0 comments on commit 504dc9d

Please sign in to comment.