From fda34cab1c92c0dee2686c0648a029fe2d891a56 Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Fri, 31 Mar 2023 18:11:54 +0900 Subject: [PATCH] Store the conditional statement in variable --- .../src/post-featured-image/dimension-controls.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/post-featured-image/dimension-controls.js b/packages/block-library/src/post-featured-image/dimension-controls.js index c3bccdf35b608b..5e1204922880c6 100644 --- a/packages/block-library/src/post-featured-image/dimension-controls.js +++ b/packages/block-library/src/post-featured-image/dimension-controls.js @@ -70,6 +70,10 @@ const DimensionControls = ( { } ); }; const scaleLabel = _x( 'Scale', 'Image scaling options' ); + + const showScaleControl = + height || ( aspectRatio && aspectRatio !== 'auto' ); + return ( - { ( height || ( aspectRatio && aspectRatio !== 'auto' ) ) && ( + { showScaleControl && ( !! scale && scale !== DEFAULT_SCALE } label={ scaleLabel }