From 4dbf463e143bba260ba66386eb9f26e8bc1d8821 Mon Sep 17 00:00:00 2001 From: Piero Nicolli Date: Tue, 14 Nov 2023 17:05:58 +0100 Subject: [PATCH] chore: rollback widget change that is not needed anymore --- RELEASE.md | 2 +- .../manage/Widgets/IconPreviewWidget.jsx | 39 ++++++++----------- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 57a5b38b1..441488d60 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -49,7 +49,7 @@ ### Fix -- Le icone del Blocco Numer, del Blocco Icone e della Sidebar si aggiornano istantaneamente quando vengono cambiate +- 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) diff --git a/src/components/ItaliaTheme/manage/Widgets/IconPreviewWidget.jsx b/src/components/ItaliaTheme/manage/Widgets/IconPreviewWidget.jsx index 40a831d78..6b4c249b6 100644 --- a/src/components/ItaliaTheme/manage/Widgets/IconPreviewWidget.jsx +++ b/src/components/ItaliaTheme/manage/Widgets/IconPreviewWidget.jsx @@ -1,4 +1,3 @@ -import React, { useState, useEffect } from 'react'; import PropTypes from 'prop-types'; import { FontAwesomeIcon } from 'design-comuni-plone-theme/components/ItaliaTheme'; import { defineMessages, useIntl } from 'react-intl'; @@ -14,11 +13,6 @@ const messages = defineMessages({ const IconPreviewWidget = ({ icon, onEdit, title, description, children }) => { const intl = useIntl(); const parts = icon?.split(' ') ?? []; - const [iconValue, setIconValue] = useState(''); - - useEffect(() => { - setIconValue(icon); - }, [icon]); return ( @@ -32,23 +26,22 @@ const IconPreviewWidget = ({ icon, onEdit, title, description, children }) => {

- {icon === iconValue && - (icon ? ( - <> - {parts.length > 1 ? ( - - ) : ( - - )} - - ) : ( - - {intl.formatMessage(messages.previewIconSelected)} - - ))} + {icon ? ( + <> + {parts.length > 1 ? ( + + ) : ( + + )} + + ) : ( + + {intl.formatMessage(messages.previewIconSelected)} + + )}