From 8c43dc1b914a9bd5b2be879cd9b77724fe0754d5 Mon Sep 17 00:00:00 2001 From: Tim Fischbach Date: Wed, 4 Dec 2024 16:23:31 +0100 Subject: [PATCH] Merge pull request #2182 from tf/info-table Add info table content element --- .../editor/SidebarEditLinkView.js | 4 +- .../externalLinkList/frontend/ExternalLink.js | 48 +++++++++++++------ .../frontend/ExternalLink.module.css | 6 +-- .../frontend/textPositons/below.module.css | 4 +- .../frontend/textPositons/right.module.css | 2 +- .../externalLinkList/stories.js | 18 +++++++ 6 files changed, 58 insertions(+), 24 deletions(-) diff --git a/entry_types/scrolled/package/src/contentElements/externalLinkList/editor/SidebarEditLinkView.js b/entry_types/scrolled/package/src/contentElements/externalLinkList/editor/SidebarEditLinkView.js index 182a9ae2c..b364028f5 100644 --- a/entry_types/scrolled/package/src/contentElements/externalLinkList/editor/SidebarEditLinkView.js +++ b/entry_types/scrolled/package/src/contentElements/externalLinkList/editor/SidebarEditLinkView.js @@ -37,9 +37,7 @@ export const SidebarEditLinkView = Marionette.Layout.extend({ var thumbnailAspectRatio = this.options.contentElement.configuration.get('thumbnailAspectRatio'); configurationEditor.tab('edit_link', function () { - this.input('url', TextInputView, { - required: true - }); + this.input('url', TextInputView); this.input('open_in_new_tab', CheckBoxInputView); this.input('thumbnail', FileInputView, { collection: 'image_files', 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 11a7bd700..8f2ad95e7 100644 --- a/entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/ExternalLink.js +++ b/entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/ExternalLink.js @@ -55,19 +55,20 @@ export function ExternalLink(props) { } return ( - +
{renderNewTabTooltip()} -
+ ); } +function LinkOrDiv({children, ...props}) { + if (props.href) { + return ( + + {children} + + ); + } + else { + return ( +
+ {children} +
+ ); + } +} function ensureAbsolute(url) { - if (url.match(/^(https?:)?\/\//)) { + if (!url || url.match(/^(https?:)?\/\//)) { return url; } else { 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 24f34e4d1..b4da8e8df 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 @@ -27,15 +27,15 @@ composes: textPosition-below; } -.textPosition-below:hover { +a.textPosition-below:hover { transform: scale(var(--theme-external-links-card-hover-scale, 1.05)); } -.textPosition-right:hover { +a.textPosition-right:hover { transform: scale(var(--theme-external-links-card-hover-scale, 1.02)); } -.item:hover .link_title { +a.item:hover .link_title { text-decoration: underline; } diff --git a/entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/textPositons/below.module.css b/entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/textPositons/below.module.css index d47ac9226..9e91e32d5 100644 --- a/entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/textPositons/below.module.css +++ b/entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/textPositons/below.module.css @@ -19,7 +19,7 @@ justify-content: center; } -.list > a { +.list > * { margin: 2% 0; width: calc((100% - var(--gap) * (var(--columns) - 1)) / var(--columns)); } @@ -45,7 +45,7 @@ } @container (max-width: 699px) { - .linkWidth-m > a { + .linkWidth-m > * { max-width: 300px; } } diff --git a/entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/textPositons/right.module.css b/entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/textPositons/right.module.css index 3c69a9a1c..792a8de26 100644 --- a/entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/textPositons/right.module.css +++ b/entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/textPositons/right.module.css @@ -8,7 +8,7 @@ justify-content: center; } -.list > a { +.list > * { width: 100%; margin: 2% 0; } diff --git a/entry_types/scrolled/package/src/contentElements/externalLinkList/stories.js b/entry_types/scrolled/package/src/contentElements/externalLinkList/stories.js index 9fb27a0f9..650d32402 100644 --- a/entry_types/scrolled/package/src/contentElements/externalLinkList/stories.js +++ b/entry_types/scrolled/package/src/contentElements/externalLinkList/stories.js @@ -113,6 +113,24 @@ storiesOfContentElement(module, { } } } + }, + { + name: 'Without link urls', + configuration: { + links: [ + { + id: '1', + title: 'Static Teaser', + thumbnail: filePermaId('imageFiles', 'turtle'), + description: 'This is description' + }, + { + id: '2', + title: 'Other item', + description: 'This is pageflowio link' + } + ] + }, } ], inlineFileRights: true