From 762f199ff5725e7ad1fb788feb4f7b7548d1ee44 Mon Sep 17 00:00:00 2001 From: Dobricean Ioan Dorian Date: Wed, 23 Aug 2023 21:34:38 +0300 Subject: [PATCH 1/4] fix popper --- src/ui/Popup/Popup.jsx | 41 ++++++++++++++++++----------- theme/themes/eea/extras/banner.less | 2 +- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/ui/Popup/Popup.jsx b/src/ui/Popup/Popup.jsx index eb70112173..d3a58dc480 100644 --- a/src/ui/Popup/Popup.jsx +++ b/src/ui/Popup/Popup.jsx @@ -33,12 +33,20 @@ function Popup(props) { ], }; - const { styles, attributes } = usePopper( + const { styles, attributes, update } = usePopper( triggerRef.current, popupRef.current, options, ); + useEffect(() => { + //force update because of ssr + const updatePlacement = async () => { + if (typeof update === 'function') await update(); + }; + updatePlacement(); + }, [isOpen, update, popupRef.current]); + const handleClickOutside = (event) => { if ( popupRef.current && @@ -72,7 +80,6 @@ function Popup(props) { const { trigger, className, size, position, basic, content, on } = props; const onEvent = 'on' + on.charAt(0).toUpperCase() + on.slice(1); - return ( {trigger && ( @@ -90,20 +97,22 @@ function Popup(props) { {...attributes.popper} > {isOpen && } - -
- {content} -
-
+ {isOpen && ( + +
+ {content} +
+
+ )}
); diff --git a/theme/themes/eea/extras/banner.less b/theme/themes/eea/extras/banner.less index a3a0666661..8a22173b5a 100644 --- a/theme/themes/eea/extras/banner.less +++ b/theme/themes/eea/extras/banner.less @@ -113,7 +113,7 @@ min-width: @sharePopupMinWidth; padding: @sharePopupPadding; filter: @sharePopupFilter; - + overflow-x: hidden; p { font-size: @sharePopupFontSize; font-weight: @sharePopupFontWeight; From bf3974be18225c893fd09814cb2aca9a84ba0ece Mon Sep 17 00:00:00 2001 From: Dobricean Ioan Dorian Date: Wed, 23 Aug 2023 22:37:50 +0300 Subject: [PATCH 2/4] remove --- src/ui/Popup/Popup.jsx | 4 +--- theme/themes/eea/extras/banner.less | 7 +------ theme/themes/eea/modules/popup.overrides | 2 ++ 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/ui/Popup/Popup.jsx b/src/ui/Popup/Popup.jsx index d3a58dc480..ea91906559 100644 --- a/src/ui/Popup/Popup.jsx +++ b/src/ui/Popup/Popup.jsx @@ -18,7 +18,6 @@ function Popup(props) { const triggerRef = useRef(null); const popupRef = useRef(null); const [isOpen, setIsOpen] = useState(false); - const options = { placement: positionsMapping[props.position] || 'bottom-end', strategy: props.positionFixed || 'absolute', @@ -40,12 +39,11 @@ function Popup(props) { ); useEffect(() => { - //force update because of ssr const updatePlacement = async () => { if (typeof update === 'function') await update(); }; updatePlacement(); - }, [isOpen, update, popupRef.current]); + }, [isOpen, update]); const handleClickOutside = (event) => { if ( diff --git a/theme/themes/eea/extras/banner.less b/theme/themes/eea/extras/banner.less index 8a22173b5a..314012770d 100644 --- a/theme/themes/eea/extras/banner.less +++ b/theme/themes/eea/extras/banner.less @@ -108,12 +108,11 @@ } /*Share Popup*/ - .ui.popup.share-popup { min-width: @sharePopupMinWidth; padding: @sharePopupPadding; filter: @sharePopupFilter; - overflow-x: hidden; + p { font-size: @sharePopupFontSize; font-weight: @sharePopupFontWeight; @@ -131,10 +130,6 @@ display: flex; justify-content: center; } - - .ui.button:not(.icon) > .icon:not(.button):not(.dropdown) { - margin: @sharePopupActionsIconMargin; - } } } diff --git a/theme/themes/eea/modules/popup.overrides b/theme/themes/eea/modules/popup.overrides index 34afc905cc..01f811e20c 100644 --- a/theme/themes/eea/modules/popup.overrides +++ b/theme/themes/eea/modules/popup.overrides @@ -84,4 +84,6 @@ .popup-container .popup { position: initial; // without position initial popper cannot correctly place popup + padding-right:10px; + margin-right:10px; } From 615e67ff3c9a0fbd6cc7cadbb0c845bf09eec4f0 Mon Sep 17 00:00:00 2001 From: Dobricean Ioan Dorian Date: Wed, 23 Aug 2023 22:39:37 +0300 Subject: [PATCH 3/4] fix --- theme/themes/eea/extras/banner.less | 6 +++++- theme/themes/eea/modules/popup.overrides | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/theme/themes/eea/extras/banner.less b/theme/themes/eea/extras/banner.less index 314012770d..f58fdce9d4 100644 --- a/theme/themes/eea/extras/banner.less +++ b/theme/themes/eea/extras/banner.less @@ -108,11 +108,11 @@ } /*Share Popup*/ + .ui.popup.share-popup { min-width: @sharePopupMinWidth; padding: @sharePopupPadding; filter: @sharePopupFilter; - p { font-size: @sharePopupFontSize; font-weight: @sharePopupFontWeight; @@ -130,6 +130,10 @@ display: flex; justify-content: center; } + + .ui.button:not(.icon) > .icon:not(.button):not(.dropdown) { + margin: @sharePopupActionsIconMargin; + } } } diff --git a/theme/themes/eea/modules/popup.overrides b/theme/themes/eea/modules/popup.overrides index 01f811e20c..34afc905cc 100644 --- a/theme/themes/eea/modules/popup.overrides +++ b/theme/themes/eea/modules/popup.overrides @@ -84,6 +84,4 @@ .popup-container .popup { position: initial; // without position initial popper cannot correctly place popup - padding-right:10px; - margin-right:10px; } From 005f2be705136eebd5f8f4ae4dd5e27d9fbff15d Mon Sep 17 00:00:00 2001 From: Dobricean Ioan Dorian Date: Wed, 23 Aug 2023 22:40:10 +0300 Subject: [PATCH 4/4] fix popper --- theme/themes/eea/extras/banner.less | 1 + 1 file changed, 1 insertion(+) diff --git a/theme/themes/eea/extras/banner.less b/theme/themes/eea/extras/banner.less index f58fdce9d4..a3a0666661 100644 --- a/theme/themes/eea/extras/banner.less +++ b/theme/themes/eea/extras/banner.less @@ -113,6 +113,7 @@ min-width: @sharePopupMinWidth; padding: @sharePopupPadding; filter: @sharePopupFilter; + p { font-size: @sharePopupFontSize; font-weight: @sharePopupFontWeight;