Skip to content

Commit 68ee410

Browse files
authored
Child Layout controls: Fix help text for height (#46319)
1 parent 15fffbc commit 68ee410

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

packages/block-editor/src/hooks/child-layout.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,19 @@ import { useEffect } from '@wordpress/element';
1414
*/
1515
import useSetting from '../components/use-setting';
1616

17-
function helpText( selfStretch ) {
18-
switch ( selfStretch ) {
19-
case 'fill':
20-
return __( 'Stretch to fill available space.' );
21-
case 'fixed':
17+
function helpText( selfStretch, parentLayout ) {
18+
const { orientation = 'horizontal' } = parentLayout;
19+
20+
if ( selfStretch === 'fill' ) {
21+
return __( 'Stretch to fill available space.' );
22+
}
23+
if ( selfStretch === 'fixed' ) {
24+
if ( orientation === 'horizontal' ) {
2225
return __( 'Specify a fixed width.' );
23-
default:
24-
return __( 'Fit contents.' );
26+
}
27+
return __( 'Specify a fixed height.' );
2528
}
29+
return __( 'Fit contents.' );
2630
}
2731

2832
/**
@@ -64,7 +68,7 @@ export function ChildLayoutEdit( {
6468
size={ '__unstable-large' }
6569
label={ childLayoutOrientation( parentLayout ) }
6670
value={ selfStretch || 'fit' }
67-
help={ helpText( selfStretch ) }
71+
help={ helpText( selfStretch, parentLayout ) }
6872
onChange={ ( value ) => {
6973
const newFlexSize = value !== 'fixed' ? null : flexSize;
7074
setAttributes( {

0 commit comments

Comments
 (0)