Skip to content

Commit

Permalink
Show Height control in Cover if we only selected an image (#17371)
Browse files Browse the repository at this point in the history
* refactor-size-control-to-its-panel

* rename Size to Dimensions
  • Loading branch information
senadir authored Sep 26, 2019
1 parent 6ab9d41 commit 5e854c2
Showing 1 changed file with 34 additions and 30 deletions.
64 changes: 34 additions & 30 deletions packages/block-library/src/cover/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,16 +329,6 @@ class CoverEdit extends Component {
onChange={ ( value ) => setAttributes( { focalPoint: value } ) }
/>
) }
<CoverHeightInput
value={ temporaryMinHeight || minHeight }
onChange={
( value ) => {
setAttributes( {
minHeight: value,
} );
}
}
/>
<PanelRow>
<Button
isDefault
Expand All @@ -359,27 +349,41 @@ class CoverEdit extends Component {
</PanelBody>
) }
{ ( url || overlayColor.color ) && (
<PanelColorSettings
title={ __( 'Overlay' ) }
initialOpen={ true }
colorSettings={ [ {
value: overlayColor.color,
onChange: setOverlayColor,
label: __( 'Overlay Color' ),
} ] }
>
{ !! url && (
<RangeControl
label={ __( 'Background Opacity' ) }
value={ dimRatio }
onChange={ setDimRatio }
min={ 0 }
max={ 100 }
step={ 10 }
required
<>
<PanelBody title={ __( 'Dimensions' ) }>
<CoverHeightInput
value={ temporaryMinHeight || minHeight }
onChange={
( value ) => {
setAttributes( {
minHeight: value,
} );
}
}
/>
) }
</PanelColorSettings>
</PanelBody>
<PanelColorSettings
title={ __( 'Overlay' ) }
initialOpen={ true }
colorSettings={ [ {
value: overlayColor.color,
onChange: setOverlayColor,
label: __( 'Overlay Color' ),
} ] }
>
{ !! url && (
<RangeControl
label={ __( 'Background Opacity' ) }
value={ dimRatio }
onChange={ setDimRatio }
min={ 0 }
max={ 100 }
step={ 10 }
required
/>
) }
</PanelColorSettings>
</>
) }
</InspectorControls>
</>
Expand Down

0 comments on commit 5e854c2

Please sign in to comment.