From 411a8ea0aba208b30f1cd9b1e8e3f8a44156481a Mon Sep 17 00:00:00 2001 From: Tim Fischbach Date: Tue, 29 Aug 2023 11:43:44 +0200 Subject: [PATCH] Use width instead position in content elements REDMINE-20384 --- .../src/contentElements/counter/Counter.js | 7 ++++--- .../src/contentElements/counter/stories.js | 5 +++-- .../src/contentElements/heading/Heading.js | 7 ++++--- .../imageGallery/ImageGallery.js | 15 +++++++++++---- .../inlineImage/InlineImage.js | 19 +++++++++++++------ .../src/contentElements/vrImage/VrImage.js | 7 ++++--- 6 files changed, 39 insertions(+), 21 deletions(-) diff --git a/entry_types/scrolled/package/src/contentElements/counter/Counter.js b/entry_types/scrolled/package/src/contentElements/counter/Counter.js index e11b2ed6a..11d6c41f6 100644 --- a/entry_types/scrolled/package/src/contentElements/counter/Counter.js +++ b/entry_types/scrolled/package/src/contentElements/counter/Counter.js @@ -8,12 +8,13 @@ import { useContentElementLifecycle, useI18n, useLocale, - paletteColor + paletteColor, + contentElementWidths } from 'pageflow-scrolled/frontend'; import styles from './Counter.module.css'; -export function Counter({configuration, contentElementId, sectionProps}) { +export function Counter({configuration, contentElementId, contentElementWidth, sectionProps}) { const updateConfiguration = useContentElementConfigurationUpdate(); const locale = useLocale(); const {t} = useI18n({locale: 'ui'}); @@ -100,7 +101,7 @@ export function Counter({configuration, contentElementId, sectionProps}) { return (
contentElementWidths.md} )}>
contentElementWidths.md || sectionProps.layout === 'centerRagged'}, {[withShadowClassName]: !sectionProps.invert})}> { return (
); } @@ -35,13 +37,15 @@ export function InlineImage({contentElementId, configuration}) { return ( ) } } function OrientationAwareInlineImage({landscapeImageFile, portraitImageFile, - contentElementId, configuration}) { + contentElementId, contentElementWidth, + configuration}) { const portraitOrientation = usePortraitOrientation(); const imageFile = portraitOrientation && portraitImageFile ? portraitImageFile : landscapeImageFile; @@ -49,14 +53,16 @@ function OrientationAwareInlineImage({landscapeImageFile, portraitImageFile, return ( ); } -function ImageWithCaption({imageFile, contentElementId, configuration}) { +function ImageWithCaption({imageFile, contentElementId, contentElementWidth, configuration}) { const {shouldLoad} = useContentElementLifecycle(); - const {enableFullscreen, position} = configuration; - const supportFullscreen = enableFullscreen && position !== "full"; + const {enableFullscreen} = configuration; + const supportFullscreen = enableFullscreen && + contentElementWidth < contentElementWidths.full; return ( diff --git a/entry_types/scrolled/package/src/contentElements/vrImage/VrImage.js b/entry_types/scrolled/package/src/contentElements/vrImage/VrImage.js index 6b8de7b63..d24f8208d 100644 --- a/entry_types/scrolled/package/src/contentElements/vrImage/VrImage.js +++ b/entry_types/scrolled/package/src/contentElements/vrImage/VrImage.js @@ -2,16 +2,17 @@ import React, {useRef, useState} from 'react'; import {useAutoCruising} from './useAutoCruising'; import { + contentElementWidths, useContentElementEditorState, useContentElementLifecycle, useFile, ContentElementBox, ContentElementFigure, Panorama, - FitViewport + FitViewport, } from 'pageflow-scrolled/frontend'; -export function VrImage({configuration}) { +export function VrImage({configuration, contentElementWidth}) { const {shouldLoad} = useContentElementLifecycle(); const {isEditable, isSelected} = useContentElementEditorState(); @@ -20,7 +21,7 @@ export function VrImage({configuration}) { return (
+ aspectRatio={contentElementWidth === contentElementWidths.full ? 0.5 : 0.75}>