Skip to content

Commit

Permalink
fix: wrong layout for external link indicator icon if objects are Plo…
Browse files Browse the repository at this point in the history
…ne Links in anonimous view (#270)

* fix: wrong layout for external link indicator icon if objects are Plone Links in anonimous view

* fix: use external link color variable instead of white

* fix: completeblocklinks show icon only if link and external, do not duplicate a tag for accessibility
  • Loading branch information
deodorhunter authored Aug 8, 2023
1 parent cfbdbc8 commit 4bbb741
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -61,13 +65,27 @@ const CompleteBlockLinksTemplate = ({
item={!isEditMode ? item : null}
href={isEditMode ? '#' : null}
data-element={id_lighthouse}
className={'no-external-if-link'}
>
<div className="d-flex">
{image && <div className="image-container">{image}</div>}
<div>
<CardBody>
<CardTitle tag="h3" className="text-secondary">
{item.title}
{item['@type'] === 'Link' &&
!isInternalURL(
item.remoteUrl || item.getRemoteUrl,
) &&
config.settings.siteProperties
.markSpecialLinks && (
<Icon
icon="it-external-link"
title={title}
size="xs"
className="align-top ms-1 external-link"
/>
)}
</CardTitle>
{show_description && (
<CardText tag="p" className="text-secondary">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ const SliderTemplate = ({
<UniversalLink
item={item}
title={intl.formatMessage(messages.viewImage)}
className={'no-external-if-link'}
>
<div className="slide-title">
{full_width ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ const UniversalLink = ({
(!isExternal && url.includes('@@display-file')) || false;

const checkedURL = URLUtils.checkAndNormalizeUrl(url);

url = checkedURL.url;
let tag = (
<Link
Expand Down
6 changes: 6 additions & 0 deletions src/theme/ItaliaTheme/Blocks/_completeBlockLinkstemplate.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@
font-size: 1rem !important;
font-weight: 700 !important;
line-height: 1.44444rem;
.external-link {
fill: $external-link-fill-buttons !important;
}
}

.card:after {
content: none;
}
.no-external-if-link > .external-link {
display: none;
}
}
3 changes: 3 additions & 0 deletions src/theme/ItaliaTheme/Views/_slider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@
padding: 0;
margin: 0;
}
.no-external-if-link > .external-link {
display: none;
}
}

0 comments on commit 4bbb741

Please sign in to comment.