From bc58d0362e4cc2530c23d2d417de07db58627862 Mon Sep 17 00:00:00 2001 From: Aminejv Date: Mon, 1 Nov 2021 07:51:13 +0100 Subject: [PATCH] fix(GlobalCarousel) - reduce header and controls animation duration to 0.25s - Use the same hover trigger for both header and controls --- .../system/components/GlobalCarousel/index.js | 64 +++++++++---------- 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/components/system/components/GlobalCarousel/index.js b/components/system/components/GlobalCarousel/index.js index f7e5073a..69528b6b 100644 --- a/components/system/components/GlobalCarousel/index.js +++ b/components/system/components/GlobalCarousel/index.js @@ -88,7 +88,12 @@ function CarouselHeader({ current, total, onAction, + onClose, + enableNextSlide, + enablePreviousSlide, + onNextSlide, + onPreviousSlide, ...props }) { const [isHeaderVisible, setHeaderVisibility] = React.useState(true); @@ -176,10 +181,22 @@ function CarouselHeader({ /> + + { - clearTimeout(timeoutRef.current); - setControlsVisibility(true); - }; - - const hideControls = () => { - timeoutRef.current = setTimeout(() => { - setControlsVisibility(false); - }, 500); - }; - - React.useEffect(() => { - timeoutRef.current = setTimeout(hideControls, 3000); - return () => clearTimeout(timeoutRef.current); - }, []); - return ( <>
{enablePreviousSlide ? ( @@ -539,16 +540,15 @@ function CarouselControls({ ) : null}
{enableNextSlide ? ( @@ -783,16 +783,6 @@ export function GlobalCarousel({ return (
- {!isMobile ? ( - 0} - onNextSlide={handleNext} - onPreviousSlide={handlePrevious} - onClose={handleClose} - /> - ) : null} - {isMobile ? ( 0} + onNextSlide={handleNext} + onPreviousSlide={handlePrevious} onClose={handleClose} /> )}