From 3d083f261b9bb7990700e150bc123494a8ceab0d Mon Sep 17 00:00:00 2001 From: Carlos Bravo Date: Thu, 22 Jun 2023 12:21:17 +0200 Subject: [PATCH] Small refactor, fix on translation --- packages/block-editor/src/hooks/behaviors.js | 27 ++++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/packages/block-editor/src/hooks/behaviors.js b/packages/block-editor/src/hooks/behaviors.js index d6cde2d9f9098..1779f4e8359ba 100644 --- a/packages/block-editor/src/hooks/behaviors.js +++ b/packages/block-editor/src/hooks/behaviors.js @@ -76,18 +76,14 @@ function BehaviorsControl( { ? __( 'The lightbox behavior is disabled for linked images.' ) : ''; - const value = () => { - if ( blockBehaviors === undefined ) { - return 'default'; - } - if ( behaviors?.lightbox.enabled ) { - return 'lightbox'; - } - return ''; - }; + let behaviorsValue = ''; - const shouldShowAnimationSelector = - value() !== 'default' && behaviors?.lightbox.enabled; + if ( blockBehaviors === undefined ) { + behaviorsValue = 'default'; + } + if ( behaviors?.lightbox.enabled ) { + behaviorsValue = 'lightbox'; + } return ( @@ -96,7 +92,7 @@ function BehaviorsControl( { - { shouldShowAnimationSelector && ( + { behaviorsValue === 'lightbox' && (