From b21b3a69b6f343626cfaa877ad792967e25c054c Mon Sep 17 00:00:00 2001 From: Jonas Brunvoll Larsson Date: Tue, 12 Nov 2024 15:44:51 +0100 Subject: [PATCH] Add help function to verify whether any of the properties in modalContent is provided. --- .../contact/components/form/input.tsx | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/page-modules/contact/components/form/input.tsx b/src/page-modules/contact/components/form/input.tsx index 0251c0c0..298f9076 100644 --- a/src/page-modules/contact/components/form/input.tsx +++ b/src/page-modules/contact/components/form/input.tsx @@ -31,8 +31,8 @@ export const Input = ({ }: InputProps) => { const { t } = useTranslation(); const [isModalOpen, setIsModalOpen] = useState(false); - const displayDescriptionModal = modalContent && isModalOpen; // Condition to avoid rendering of useEffect inside DescriptionModal before opened. - + const isModalContentProvided = hasModalContent(modalContent); + const displayDescriptionModal = isModalOpen && isModalContentProvided; const toggleModalState = () => { setIsModalOpen(!isModalOpen); }; @@ -49,7 +49,7 @@ export const Input = ({ {t(label)} - {modalContent && ( + {isModalContentProvided && (