Skip to content

Commit

Permalink
fix: view text and external links in footer
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliaghisini committed Apr 11, 2024
1 parent 22a1e39 commit 36eb473
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
27 changes: 20 additions & 7 deletions src/components/ItaliaTheme/Footer/FooterInfos.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import React, { useEffect } from 'react';

import { useDispatch, useSelector } from 'react-redux';
import { useLocation } from 'react-router-dom';

Expand All @@ -17,6 +18,9 @@ import {
FooterSocials,
} from 'design-comuni-plone-theme/components/ItaliaTheme';

import { TextBlockView } from '@plone/volto-slate/blocks/Text';
import { fromHtml } from 'design-comuni-plone-theme/config/Slate/utils';

const messages = defineMessages({
goToPage: {
id: 'Vai alla pagina',
Expand All @@ -39,10 +43,15 @@ const FooterInfos = () => {
}, [dispatch, location]);

//filter rootpaths
const footerColumns = getItemsByPath(
let footerColumns = getItemsByPath(
footerConfiguration,
location?.pathname?.length ? location.pathname : '/',
);
footerColumns.forEach((column) => {
if (__CLIENT__) {
column.slateText = fromHtml(column.text);
}
});

const colWidth =
12 / (footerColumns.length < N_COLUMNS ? footerColumns.length : N_COLUMNS);
Expand Down Expand Up @@ -76,12 +85,16 @@ const FooterInfos = () => {
</h4>
{column.showSocial && <FooterSocials />}

<div
dangerouslySetInnerHTML={{
__html: flattenHTMLToAppURL(column.text.data),
}}
/>

{column.slateText ? (
<TextBlockView data={{ value: column.slateText }} />
) : (
<div
dangerouslySetInnerHTML={{
__html: flattenHTMLToAppURL(column.text.data),
}}
/>
)}
{/* <TextBlockView id={index} data={{ value: data.text }} /> */}
{column.newsletterSubscribe && <FooterNewsletterSubscribe />}
</Col>
))}
Expand Down
6 changes: 3 additions & 3 deletions src/components/ItaliaTheme/Footer/FooterNavigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ const FooterNavigation = () => {
title: item.title,
}}
/>
<Link
to={item.url}
<UniversalLink
href={item.url}
title={
intl.formatMessage(messages.goToPage) + ': ' + item.title
}
>
{item.title}
<Icon icon="it-arrow-right" color="white" />
</Link>
</UniversalLink>
</h4>
{/* DEPRECATED: isFooterCollapsed to be removed in version 12 */}
{!config.settings.isFooterCollapsed &&
Expand Down

0 comments on commit 36eb473

Please sign in to comment.