From 10c901651a96cdde9bf90dd7a3e69fb06123bcf1 Mon Sep 17 00:00:00 2001 From: SV Date: Sat, 16 May 2026 20:44:12 +0530 Subject: [PATCH 1/2] feat: replace footer link with floating back to top button --- app/components/ProgressBar.tsx | 39 ++++++++++++++++++++++++++-------- app/components/footer.tsx | 15 +------------ 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/app/components/ProgressBar.tsx b/app/components/ProgressBar.tsx index 185ea79..f2a421d 100644 --- a/app/components/ProgressBar.tsx +++ b/app/components/ProgressBar.tsx @@ -2,9 +2,11 @@ import { useEffect, useState } from 'react'; import { usePathname } from 'next/navigation'; +import { ArrowUp } from 'lucide-react'; export default function ProgressBar() { const [scrollPercentage, setScrollPercentage] = useState(0); + const [showBackToTop, setShowBackToTop] = useState(false); const pathname = usePathname(); useEffect(() => { @@ -14,6 +16,7 @@ export default function ProgressBar() { const scrollY = window.scrollY; const scrollableDistance = documentHeight - windowHeight; + setShowBackToTop(scrollY > 300); if (scrollableDistance > 0) { const percentage = (scrollY / scrollableDistance) * 100; @@ -30,20 +33,38 @@ export default function ProgressBar() { return () => window.removeEventListener('scroll', handleScroll); }, [pathname]); - if (!pathname.startsWith('/sem')) { - return null; - } + const scrollToTop = () => { + window.scrollTo({ top: 0, behavior: 'smooth' }); + }; return ( - -
-
+ {pathname.startsWith('/sem') && ( +
+
-
+ /> +
+ )} + + {showBackToTop && ( + + )} + ); } \ No newline at end of file diff --git a/app/components/footer.tsx b/app/components/footer.tsx index 5a1db1b..331eab7 100644 --- a/app/components/footer.tsx +++ b/app/components/footer.tsx @@ -1,6 +1,6 @@ "use client"; import Link from "next/link"; -import { Github, Linkedin, Twitter, Mail, ArrowUp } from "lucide-react"; +import { Github, Linkedin, Twitter, Mail } from "lucide-react"; import { Road_Rage } from "next/font/google"; const roadRage = Road_Rage({ @@ -10,10 +10,6 @@ const roadRage = Road_Rage({ }); export default function Footer() { - const scrollToTop = () => { - window.scrollTo({ top: 0, behavior: "smooth" }); - }; - return (
@@ -59,15 +55,6 @@ export default function Footer() {
- -
From bc37c62dd244753ae25af28c0b9898af70b7de29 Mon Sep 17 00:00:00 2001 From: SV Date: Sun, 17 May 2026 09:17:16 +0530 Subject: [PATCH 2/2] chore:resore footer link --- app/components/footer.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/components/footer.tsx b/app/components/footer.tsx index 331eab7..b3021f2 100644 --- a/app/components/footer.tsx +++ b/app/components/footer.tsx @@ -1,6 +1,6 @@ "use client"; import Link from "next/link"; -import { Github, Linkedin, Twitter, Mail } from "lucide-react"; +import { Github, Linkedin, Twitter, Mail, ArrowUp } from "lucide-react"; import { Road_Rage } from "next/font/google"; const roadRage = Road_Rage({ @@ -10,6 +10,9 @@ const roadRage = Road_Rage({ }); export default function Footer() { + const scrollToTop = () => { + window.scrollTo({ top: 0, behavior: "smooth" }); + }; return (