From d1f8258764ae781f018309f6c52b8cf02d5c1b2e Mon Sep 17 00:00:00 2001 From: Martina Bustacchini Date: Fri, 4 Aug 2023 10:40:55 +0200 Subject: [PATCH 1/2] fix: wrong layout for external link indicator icon if objects are Plone Links in anonimous view --- .../Blocks/Listing/CompleteBlockLinksTemplate.jsx | 12 +++++++++++- .../ItaliaTheme/Blocks/Listing/SliderTemplate.jsx | 1 + .../Blocks/_completeBlockLinkstemplate.scss | 9 +++++++++ theme/ItaliaTheme/Views/_slider.scss | 3 +++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/components/ItaliaTheme/Blocks/Listing/CompleteBlockLinksTemplate.jsx b/src/components/ItaliaTheme/Blocks/Listing/CompleteBlockLinksTemplate.jsx index 770cd2cbc..60ee91a3a 100644 --- a/src/components/ItaliaTheme/Blocks/Listing/CompleteBlockLinksTemplate.jsx +++ b/src/components/ItaliaTheme/Blocks/Listing/CompleteBlockLinksTemplate.jsx @@ -54,13 +54,23 @@ const CompleteBlockLinksTemplate = ({ item={!isEditMode ? item : null} href={isEditMode ? '#' : null} data-element={id_lighthouse} + className={'no-external-if-link'} >
{image &&
{image}
}
- {item.title} + {item['@type'] === 'Link' ? ( + + {item.title} + + ) : ( + item.title + )} {show_description && ( diff --git a/src/components/ItaliaTheme/Blocks/Listing/SliderTemplate.jsx b/src/components/ItaliaTheme/Blocks/Listing/SliderTemplate.jsx index 7c37a16d4..bdc57a58e 100644 --- a/src/components/ItaliaTheme/Blocks/Listing/SliderTemplate.jsx +++ b/src/components/ItaliaTheme/Blocks/Listing/SliderTemplate.jsx @@ -161,6 +161,7 @@ const SliderTemplate = ({
{full_width ? ( diff --git a/theme/ItaliaTheme/Blocks/_completeBlockLinkstemplate.scss b/theme/ItaliaTheme/Blocks/_completeBlockLinkstemplate.scss index 0d3f5f327..e8643f771 100644 --- a/theme/ItaliaTheme/Blocks/_completeBlockLinkstemplate.scss +++ b/theme/ItaliaTheme/Blocks/_completeBlockLinkstemplate.scss @@ -67,9 +67,18 @@ font-size: 1rem !important; font-weight: 700 !important; line-height: 1.44444rem; + a { + color: $secondary-text !important; + } + .external-link { + fill: $external-link-fill-buttons !important; + } } .card:after { content: none; } + .no-external-if-link > .external-link { + display: none; + } } diff --git a/theme/ItaliaTheme/Views/_slider.scss b/theme/ItaliaTheme/Views/_slider.scss index 1ed3ecac9..3b1c83bc8 100644 --- a/theme/ItaliaTheme/Views/_slider.scss +++ b/theme/ItaliaTheme/Views/_slider.scss @@ -21,4 +21,7 @@ padding: 0; margin: 0; } + .no-external-if-link > .external-link { + display: none; + } } From 13bd32e5b79534a1badf3fcc3b99f25daecd1d53 Mon Sep 17 00:00:00 2001 From: Martina Bustacchini Date: Tue, 8 Aug 2023 09:47:16 +0200 Subject: [PATCH 2/2] fix: completeblocklinks show icon only if link and external, do not duplicate a tag for accessibility --- .../Listing/CompleteBlockLinksTemplate.jsx | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/components/ItaliaTheme/Blocks/Listing/CompleteBlockLinksTemplate.jsx b/src/components/ItaliaTheme/Blocks/Listing/CompleteBlockLinksTemplate.jsx index 60ee91a3a..f163664d6 100644 --- a/src/components/ItaliaTheme/Blocks/Listing/CompleteBlockLinksTemplate.jsx +++ b/src/components/ItaliaTheme/Blocks/Listing/CompleteBlockLinksTemplate.jsx @@ -15,6 +15,10 @@ import { ListingLinkMore, ListingImage, } from 'design-comuni-plone-theme/components/ItaliaTheme'; +import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme'; +import { isInternalURL } from '@plone/volto/helpers/Url/Url'; + +import config from '@plone/volto/registry'; const CompleteBlockLinksTemplate = ({ items, @@ -61,16 +65,20 @@ const CompleteBlockLinksTemplate = ({
- {item['@type'] === 'Link' ? ( - - {item.title} - - ) : ( - item.title - )} + {item.title} + {item['@type'] === 'Link' && + !isInternalURL( + item.remoteUrl || item.getRemoteUrl, + ) && + config.settings.siteProperties + .markSpecialLinks && ( + + )} {show_description && (