From b63d8bebe44d38c34060ce5a097f7a8b987bfe5f Mon Sep 17 00:00:00 2001 From: Abdullah Rather Date: Mon, 23 Jun 2025 08:37:37 +0000 Subject: [PATCH] fix: following changes made: - Smaller scroll buttons on mobile view - Hide Scroll buttons when the navbar is opened on mobile. --- src/components/Layout.jsx | 2 +- src/components/ScrollControls.jsx | 41 +++++++++++++++++-------------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/components/Layout.jsx b/src/components/Layout.jsx index 2c7c09b..67dd028 100644 --- a/src/components/Layout.jsx +++ b/src/components/Layout.jsx @@ -494,7 +494,7 @@ const Layout = ({ children }) => { {/* Scroll Controls */} - + ); }; diff --git a/src/components/ScrollControls.jsx b/src/components/ScrollControls.jsx index 85de275..ccaf3ee 100644 --- a/src/components/ScrollControls.jsx +++ b/src/components/ScrollControls.jsx @@ -4,7 +4,7 @@ import { ScrollToPlugin } from "gsap/ScrollToPlugin"; gsap.registerPlugin(ScrollToPlugin); -const ScrollControls = () => { +const ScrollControls = ({ isMobileMenuOpen = false }) => { const [scrollProgress, setScrollProgress] = useState(0); const [showTopBtn, setShowTopBtn] = useState(false); const [showBottomBtn, setShowBottomBtn] = useState(true); @@ -60,7 +60,7 @@ const ScrollControls = () => { }, }); - // Button press “blink” + // Button press "blink" gsap.to(".scroll-to-top", { scale: 0.9, duration: 0.1, @@ -99,8 +99,11 @@ const ScrollControls = () => { const modalOverlay = document.querySelector(".modal-overlay"); const isModalOpen = Boolean(modalOverlay); - // If the modal is open, do not render any scroll buttons or ring: - if (isModalOpen) { + /* Hide scroll controls if: + * Modal is open + * Mobile menu is open + */ + if (isModalOpen || isMobileMenuOpen) { return null; } @@ -112,7 +115,7 @@ const ScrollControls = () => { onClick={scrollToTop} disabled={isScrolling} className={` - scroll-to-top fixed right-6 bottom-20 z-50 group transition-all duration-500 + scroll-to-top fixed right-3 bottom-16 md:right-6 md:bottom-20 z-50 group transition-all duration-500 ${ showTopBtn ? "opacity-100 translate-y-0 pointer-events-auto" @@ -122,29 +125,29 @@ const ScrollControls = () => { `} aria-label='Scroll to top' > -
+
{/* Background Ring */} - + {/* Progress Ring */} @@ -168,7 +171,7 @@ const ScrollControls = () => { {/* Arrow Icon */}
{
{/* Tooltip */} -
+
{isScrolling ? "Scrolling..." : "Back to top"}
@@ -210,7 +213,7 @@ const ScrollControls = () => { onClick={scrollToBottom} disabled={isScrolling} className={` - scroll-to-bottom fixed right-6 bottom-4 z-50 group transition-all duration-500 + scroll-to-bottom fixed right-3 bottom-4 md:right-6 md:bottom-4 z-50 group transition-all duration-500 ${ showBottomBtn ? "opacity-100 translate-y-0 pointer-events-auto" @@ -220,11 +223,11 @@ const ScrollControls = () => { `} aria-label='Scroll to bottom' > -
+
{/* Arrow Icon */}
{
{/* Tooltip */} -
+
{isScrolling ? "Scrolling..." : "Go to bottom"}