From d021e3a9a3e02668b6e4768123cb4db7cee7979b Mon Sep 17 00:00:00 2001 From: Tim Fischbach Date: Wed, 23 Apr 2025 15:00:37 +0200 Subject: [PATCH 1/3] Fine tune teaser text positions * Display icon inline file rights in upper corner for overlay text position. * Display text inline file rights below card for overlay, right and none text position. * Align buttons vertically. * Center card content vertically in text position right. REDMINE-20852 --- .../externalLinkList/editor/index.js | 1 + .../externalLinkList/frontend/ExternalLink.js | 102 ++++++++++-------- .../frontend/ExternalLink.module.css | 61 +++++++++-- .../externalLinkList/stories.js | 58 ++++++++++ .../package/src/frontend/InlineFileRights.js | 5 +- .../src/frontend/LinkButton.module.css | 1 + .../package/src/frontend/Text.module.css | 3 - .../IconInlineFileRights.js | 4 +- .../IconInlineFileRights.module.css | 29 ++++- 9 files changed, 204 insertions(+), 60 deletions(-) diff --git a/entry_types/scrolled/package/src/contentElements/externalLinkList/editor/index.js b/entry_types/scrolled/package/src/contentElements/externalLinkList/editor/index.js index e122329298..c70765f420 100644 --- a/entry_types/scrolled/package/src/contentElements/externalLinkList/editor/index.js +++ b/entry_types/scrolled/package/src/contentElements/externalLinkList/editor/index.js @@ -85,6 +85,7 @@ editor.contentElementTypes.register('externalLinkList', { values: ['left', 'right', 'center'] }); this.input('displayButtons', CheckBoxInputView); + this.group('ContentElementInlineFileRightsSettings'); }); } }); diff --git a/entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/ExternalLink.js b/entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/ExternalLink.js index 59ffb5d525..5cf5c3884d 100644 --- a/entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/ExternalLink.js +++ b/entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/ExternalLink.js @@ -87,6 +87,11 @@ export function ExternalLink({id, configuration, ...props}) { const scaleCategorySuffix = scaleCategorySuffixes[props.textSize || 'small']; + const inlineFileRightsAfterCard = props.textPosition === 'right' || + props.textPosition === 'overlay' || + props.textPosition === 'none'; + + const inlineFileRightsItems = [{file: thumbnailImageFile, label: 'image'}]; return (
  • -
    -
    - - - -
    -
    - -
    - {presentOrEditing('tagline') && - - handleTextChange('tagline', value)} /> - } - - handleTextChange('title', value)} /> - - {presentOrEditing('description') && -
    +
    +
    +
    + + + +
    +
    + {!inlineFileRightsAfterCard && + } +
    + {presentOrEditing('tagline') && + + handleTextChange('tagline', value)} /> + } + + handleTextChange('title', value)} /> + + {presentOrEditing('description') && handleTextChange('description', value)} /> -
    } - {configuration.displayButtons && presentOrEditing('link') && - handleTextChange('link', value)} - onLinkChange={value => handleLinkChange(value)} />} + onChange={value => handleTextChange('description', value)} />} + {configuration.displayButtons && presentOrEditing('link') && +
    + handleTextChange('link', value)} + onLinkChange={value => handleLinkChange(value)} /> +
    } +
    + {inlineFileRightsAfterCard && +
    + +
    }
  • diff --git a/entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/ExternalLink.module.css b/entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/ExternalLink.module.css index 7398abda03..777688bfce 100644 --- a/entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/ExternalLink.module.css +++ b/entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/ExternalLink.module.css @@ -34,19 +34,34 @@ opacity: 1; } +.textPosition-below .cardWrapper, +.textPosition-right .cardWrapper{ + height: 100%; + display: flex; + flex-direction: column; +} + .card { display: flex; - vertical-align: top; border-radius: var(--theme-content-element-box-border-radius); overflow: hidden; will-change: transform; - height: 100%; + flex: 1; } .textPosition-below .card { flex-direction: column; } +.textPosition-overlay .card { + display: grid; +} + +.textPosition-overlay .card > * { + grid-row: 1; + grid-column: 1; +} + .textPosition-none { composes: textPosition-below; } @@ -96,19 +111,23 @@ } .background { - --padding-inline: var(--theme-external-links-card-padding-inline, 15px); color: var(--content-text-color); background-color: var(--card-surface-color); flex: 1; + display: flex; + flex-direction: column; +} + +.textPosition-below .background, +.textPosition-overlay .background { + --padding-inline: var(--theme-external-links-card-padding-inline, 15px); padding-left: min(var(--padding-inline), 5px); padding-right: min(var(--padding-inline), 5px); } .textPosition-overlay .background { - position: absolute; - bottom: 0; - width: 100%; - box-sizing: border-box; + position: relative; + align-self: end; background: transparent; z-index: 1; } @@ -123,12 +142,19 @@ bottom: 0; background: linear-gradient(0deg, var(--card-surface-color), transparent); opacity: calc(0.9 * var(--overlay-opacity, 0.7)); + pointer-events: none; } .textPosition-none .background { display: none; } +.details { + display: flex; + flex-direction: column; + flex: 1; +} + .textPosition-below .details, .textPosition-overlay .details { padding-top: 15px; @@ -143,7 +169,8 @@ } .textPosition-right .details { - padding: 10px 10px 10px 15px; + justify-content: center; + padding: max(10px, 10%) max(20px, 3%); } .details p, @@ -151,7 +178,19 @@ margin-bottom: 0; } -.link { +.details p { + margin-top: 1rem; +} + +.button { + flex: 1; + display: flex; + flex-direction: column; + justify-content: flex-end; +} + +.textPosition-below .button, +.textPosition-overlay .button { margin-bottom: -5px; } @@ -162,3 +201,7 @@ .align-right { text-align: right; } + +.textPosition-right .inlineFileRightsAfterCard { + display: flex; +} diff --git a/entry_types/scrolled/package/src/contentElements/externalLinkList/stories.js b/entry_types/scrolled/package/src/contentElements/externalLinkList/stories.js index 048e09d5c2..ba96ba6ea8 100644 --- a/entry_types/scrolled/package/src/contentElements/externalLinkList/stories.js +++ b/entry_types/scrolled/package/src/contentElements/externalLinkList/stories.js @@ -166,6 +166,27 @@ storiesOfContentElement(module, { ] }, }, + { + name: 'Text inline file rights, text position right', + configuration: { + textPosition: 'right' + }, + inlineFileRightsWidgetTypeName: 'textInlineFileRights', + }, + { + name: 'Text inline file rights, text position overlay', + configuration: { + textPosition: 'overlay' + }, + inlineFileRightsWidgetTypeName: 'textInlineFileRights', + }, + { + name: 'Icon inline file rights, text position overlay', + configuration: { + textPosition: 'overlay' + }, + inlineFileRightsWidgetTypeName: 'iconInlineFileRights', + }, { name: 'With buttons', configuration: { @@ -202,6 +223,43 @@ storiesOfContentElement(module, { ] } }, + { + name: 'With buttons, text position right', + configuration: { + displayButtons: true, + textPosition: 'right', + itemTexts: { + 1: { + title: editableTextValue('Item 1'), + description: editableTextValue('This is description'), + link: editableTextValue('Read more') + }, + 2: { + title: editableTextValue('Item 2'), + description: editableTextValue('This is another description'), + link: editableTextValue('Read more') + } + }, + itemLinks: { + 1: { + href: 'https://www.pageflow.io/' + }, + 2: { + href: 'https://www.pageflow.io/' + } + }, + links: [ + { + id: '1', + thumbnail: filePermaId('imageFiles', 'turtle') + }, + { + id: '2', + thumbnail: filePermaId('imageFiles', 'turtle') + } + ] + } + }, { name: 'With legacy external links', configuration: { diff --git a/entry_types/scrolled/package/src/frontend/InlineFileRights.js b/entry_types/scrolled/package/src/frontend/InlineFileRights.js index 33f26aa367..40809e1eab 100644 --- a/entry_types/scrolled/package/src/frontend/InlineFileRights.js +++ b/entry_types/scrolled/package/src/frontend/InlineFileRights.js @@ -8,6 +8,7 @@ import styles from './InlineFileRights.module.css'; export function InlineFileRights({items = [], context = 'standAlone', + position, playerControlsFadedOut, playerControlsStandAlone, configuration = {}}) { @@ -22,7 +23,9 @@ export function InlineFileRights({items = [], return ( + props={{context, position, + playerControlsFadedOut, playerControlsStandAlone, + configuration}}>