Skip to content

Commit

Permalink
Merge branch 'main' into bug_47482_ricerca_in_testata
Browse files Browse the repository at this point in the history
  • Loading branch information
pnicolli committed Nov 14, 2023
2 parents ad09ea1 + 0df93a5 commit 5235b2c
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 22 deletions.
2 changes: 2 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
### Fix

- Quando viene effettuata una ricerca dalla barra di ricerca nelle sezioni Amministrazione, Servizi, Novità, o Documenti e Dati, viene automaticamente impostato il filtro sulla sezione stessa così da mostrare solo i contenuti corrispondenti.
- Le icone del Blocco Numeri, del Blocco Icone e della Sidebar si aggiornano istantaneamente quando vengono cambiate
- Sistemato un bug nell'header dei sottositi che mostrava le voci del menu del sito padre anche se queste erano indicate come non visibili nella configurazione del menu.

## Versione 10.3.0 (08/11/2023)

Expand Down
1 change: 1 addition & 0 deletions src/components/ItaliaTheme/Blocks/NumbersBlock/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class Edit extends SubblocksEdit {
super(props);
this.state.selectedField = 'title';
}

/**
* Render method.
* @method render
Expand Down
3 changes: 2 additions & 1 deletion src/components/ItaliaTheme/Header/ParentSiteMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ const ParentSiteMenu = () => {
// eslint-disable-next-line no-loop-func
dropdownMenu.forEach((m) => {
if (m.rootPath === s) {
menu = m;
// Filter non visible dropdown menu entries
menu = { ...m, items: m.items.filter((mi) => mi.visible) };
i = 0;
}
});
Expand Down
62 changes: 42 additions & 20 deletions src/components/ItaliaTheme/Icons/FontAwesomeIcon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import { fontAwesomeAliases } from 'design-comuni-plone-theme/helpers/index';

const FontAwesomeIcon = (props) => {
const { className, icon, prefix, title } = props;
const [loadedIcon, setLoadedIcon] = React.useState(null);
const [loadedIcon, setLoadedIcon] = React.useState({
module: null,
iconName: '',
family: 'solid',
});

const getIconAlias = (icon, aliasList) => {
if (icon in aliasList) {
Expand All @@ -17,40 +21,58 @@ const FontAwesomeIcon = (props) => {
}
};

let prefixKey = prefix;
let iconName = '';

if (Array.isArray(icon)) {
prefixKey = icon[0];
iconName = getIconAlias(icon[1], fontAwesomeAliases);
} else {
iconName = getIconAlias(icon, fontAwesomeAliases);
}
const getIconInfo = (icon, prefix) => {
let prefixKey = prefix;
let iconName = '';
if (Array.isArray(icon)) {
prefixKey = icon[0];
iconName = getIconAlias(icon[1], fontAwesomeAliases);
} else {
iconName = getIconAlias(icon, fontAwesomeAliases);
}

const prefixFolder =
prefixKey === 'fab' ? 'brands' : prefixKey === 'far' ? 'regular' : 'solid';
return [
prefixKey === 'fab'
? 'brands'
: prefixKey === 'far'
? 'regular'
: 'solid',
iconName,
];
};

React.useEffect(() => {
if (iconName && !loadedIcon) {
const [prefixFolder, iconName] = getIconInfo(icon, prefix);
if (
iconName &&
(iconName !== loadedIcon.iconName || prefixFolder !== loadedIcon.family)
) {
import(
`design-comuni-plone-theme/icons/fontawesome-free-6.4.0-web/svgs/${prefixFolder}/${iconName}.svg`
)
.then((_loadedIcon) => {
setLoadedIcon(_loadedIcon);
setLoadedIcon({
module: _loadedIcon.default,
iconName,
family: prefixFolder,
});
})
.catch((error) => {});
}
}, [iconName, loadedIcon, prefixFolder]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [icon, prefix, loadedIcon]);

return loadedIcon ? (
return loadedIcon.module ? (
<svg
xmlns={loadedIcon.attributes && loadedIcon.attributes.xmlns}
viewBox={loadedIcon.attributes && loadedIcon.attributes.viewBox}
xmlns={loadedIcon.module.attributes && loadedIcon.module.attributes.xmlns}
viewBox={
loadedIcon.module.attributes && loadedIcon.module.attributes.viewBox
}
className={`icon fa-icon ${className ?? ''}`}
dangerouslySetInnerHTML={{
__html: title
? `<title>${title}</title>${loadedIcon.content}`
: loadedIcon.content,
? `<title>${title}</title>${loadedIcon.module.content}`
: loadedIcon.module.content,
}}
/>
) : icon ? (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import { FontAwesomeIcon } from 'design-comuni-plone-theme/components/ItaliaTheme';
import { defineMessages, useIntl } from 'react-intl';
Expand All @@ -14,6 +13,7 @@ const messages = defineMessages({
const IconPreviewWidget = ({ icon, onEdit, title, description, children }) => {
const intl = useIntl();
const parts = icon?.split(' ') ?? [];

return (
<Form.Field inline className="help" id="icon-preview-widget-id">
<Grid>
Expand Down

0 comments on commit 5235b2c

Please sign in to comment.