From a79e9bfa144d1a4b05425b78ef4182830deb429d Mon Sep 17 00:00:00 2001 From: Souradeep858 Date: Mon, 15 Jun 2026 13:11:02 +0530 Subject: [PATCH 1/3] back to top added --- frontend/src/App.jsx | 2 + frontend/src/components/shared/Backtotop.jsx | 46 ++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 frontend/src/components/shared/Backtotop.jsx diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 4e1b5ce..be6e73c 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -28,6 +28,7 @@ import ProtectedRoute from "./components/shared/ProtectedRoute"; import PublicRoute from "./components/shared/PublicRoute"; import BugReportsPage from "./pages/BugReportsPage"; import Contact from "./pages/Contact"; +import BackToTop from './components/shared/Backtotop'; export default function App() { return ( @@ -119,6 +120,7 @@ export default function App() { } /> + diff --git a/frontend/src/components/shared/Backtotop.jsx b/frontend/src/components/shared/Backtotop.jsx new file mode 100644 index 0000000..844a850 --- /dev/null +++ b/frontend/src/components/shared/Backtotop.jsx @@ -0,0 +1,46 @@ +import { useEffect, useState } from 'react'; +import { FaArrowUp } from 'react-icons/fa6'; + +const BackToTop = () => { + const [visible, setVisible] = useState(false); + + useEffect(() => { + const toggleVisibility = () => { + setVisible(window.scrollY > 300); + }; + + window.addEventListener('scroll', toggleVisibility); + + return () => window.removeEventListener('scroll', toggleVisibility); + }, []); + + const scrollToTop = () => { + window.scrollTo({ + top: 0, + behavior: 'smooth', + }); + }; + + return ( + + ); +}; + +export default BackToTop; \ No newline at end of file From 123f89fc105a7e66a80d17b82e6bdcdb52de8908 Mon Sep 17 00:00:00 2001 From: Souradeep Chakraborty Date: Mon, 15 Jun 2026 20:58:16 +0530 Subject: [PATCH 2/3] Replace FaArrowUp with ArrowUp and update styles --- frontend/src/components/shared/Backtotop.jsx | 24 +++++++++----------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/frontend/src/components/shared/Backtotop.jsx b/frontend/src/components/shared/Backtotop.jsx index 844a850..91a5388 100644 --- a/frontend/src/components/shared/Backtotop.jsx +++ b/frontend/src/components/shared/Backtotop.jsx @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react'; -import { FaArrowUp } from 'react-icons/fa6'; +import { ArrowUp } from 'lucide-react'; const BackToTop = () => { const [visible, setVisible] = useState(false); @@ -9,6 +9,8 @@ const BackToTop = () => { setVisible(window.scrollY > 300); }; + toggleVisibility(); // Initialize on mount + window.addEventListener('scroll', toggleVisibility); return () => window.removeEventListener('scroll', toggleVisibility); @@ -21,26 +23,22 @@ const BackToTop = () => { }); }; + if (!visible) return null; + return ( ); }; -export default BackToTop; \ No newline at end of file +export default BackToTop; From 512fbcec6f654d5722752866a05f240720dc18a2 Mon Sep 17 00:00:00 2001 From: Souradeep Chakraborty Date: Mon, 15 Jun 2026 21:02:02 +0530 Subject: [PATCH 3/3] Enhance BackToTop component visibility and accessibility Updated BackToTop component to improve visibility handling and accessibility attributes. --- frontend/src/components/shared/Backtotop.jsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/shared/Backtotop.jsx b/frontend/src/components/shared/Backtotop.jsx index 91a5388..ae99fd5 100644 --- a/frontend/src/components/shared/Backtotop.jsx +++ b/frontend/src/components/shared/Backtotop.jsx @@ -9,7 +9,7 @@ const BackToTop = () => { setVisible(window.scrollY > 300); }; - toggleVisibility(); // Initialize on mount + toggleVisibility(); window.addEventListener('scroll', toggleVisibility); @@ -23,18 +23,23 @@ const BackToTop = () => { }); }; - if (!visible) return null; - return (