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..b3021f2 100644 --- a/app/components/footer.tsx +++ b/app/components/footer.tsx @@ -13,7 +13,6 @@ export default function Footer() { const scrollToTop = () => { window.scrollTo({ top: 0, behavior: "smooth" }); }; - return (