Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cover: Move cover min-height into dimensions panel via SlotFill #34065

Merged
Merged
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
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