Skip to content

Commit

Permalink
Cover: Move cover min-height into dimensions panel via SlotFill (#34065)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw authored Sep 10, 2021
1 parent 4dc6fe8 commit c5a842a
Showing 1 changed file with 32 additions and 14 deletions.
46 changes: 32 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,37 @@ function CoverEdit( {
) }
</PanelColorGradientSettings>
</InspectorControls>
<InspectorControls __experimentalGroup="dimensions">
<ToolsPanelItem
hasValue={ () => !! minHeight }
label={ __( 'Minimum height' ) }
onDeselect={ () =>
setAttributes( {
minHeight: undefined,
minHeightUnit: undefined,
} )
}
resetAllFilter={ () => ( {
minHeight: undefined,
minHeightUnit: undefined,
} ) }
isShownByDefault={ true }
panelId={ clientId }
>
<CoverHeightInput
value={ temporaryMinHeight || minHeight }
unit={ minHeightUnit }
onChange={ ( newMinHeight ) =>
setAttributes( { minHeight: newMinHeight } )
}
onUnitChange={ ( nextUnit ) =>
setAttributes( {
minHeightUnit: nextUnit,
} )
}
/>
</ToolsPanelItem>
</InspectorControls>
</>
);

Expand Down

0 comments on commit c5a842a

Please sign in to comment.