From 2ef9a29add15fbc837ecf9debd8afdfbc87881fa Mon Sep 17 00:00:00 2001 From: qradle Date: Wed, 17 Jan 2024 19:27:27 +0300 Subject: [PATCH] fix: layout item renderMedia --- src/sub-blocks/LayoutItem/LayoutItem.tsx | 44 ++++++++++++------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/sub-blocks/LayoutItem/LayoutItem.tsx b/src/sub-blocks/LayoutItem/LayoutItem.tsx index f4adf496a..8837a5e06 100644 --- a/src/sub-blocks/LayoutItem/LayoutItem.tsx +++ b/src/sub-blocks/LayoutItem/LayoutItem.tsx @@ -26,32 +26,32 @@ const LayoutItem = ({ size: 's', colSizes: {all: 12, md: 12}, }; - return ( -
- {media ? ( - fullscreen && hasFullscreen(media) ? ( - - {({ - className: mediaClassName, - fullscreen: _fullscreen, - ...fullscreenMediaProps - } = {}) => ( - - )} - - ) : ( + const renderMedia = () => { + if (!media) { + return null; + } + return fullscreen && hasFullscreen(media) ? ( + + {({ + className: mediaClassName, + fullscreen: _fullscreen, + ...fullscreenMediaProps + } = {}) => ( - ) - ) : null} + )} + + ) : ( + + ); + }; + return ( +
+ {renderMedia()} {metaInfo && }