diff --git a/components/InstructorCard.tsx b/components/InstructorCard.tsx index ec6a5ee..3fead4c 100644 --- a/components/InstructorCard.tsx +++ b/components/InstructorCard.tsx @@ -3,30 +3,39 @@ import type { Instructor } from '@/lib/data'; export function InstructorCard({ instructor }: { instructor: Instructor }) { return ( -
+
+

{instructor.location}

{instructor.name}

- + ${instructor.ratePerHour}/hr
+

{instructor.description}

-
+ +
{instructor.specialties.map((tag) => ( {tag} ))}
-
+ +

{instructor.languages.join(' • ')}

- + + View profile
+
); -} +} \ No newline at end of file diff --git a/components/ScrollToTop.tsx b/components/ScrollToTop.tsx index 954c846..7096e3f 100644 --- a/components/ScrollToTop.tsx +++ b/components/ScrollToTop.tsx @@ -1,15 +1,45 @@ "use client"; - -import { useEffect } from "react"; +import { useEffect, useState } from "react"; import { usePathname } from "next/navigation"; export default function ScrollToTop() { + const [isVisible, setIsVisible] = useState(false); const pathname = usePathname(); useEffect(() => { window.scrollTo(0, 0); }, [pathname]); - return null; + useEffect(() => { + const toggleVisibility = () => { + if (window.scrollY > 300) { + setIsVisible(true); + } else { + setIsVisible(false); + } + }; + + window.addEventListener("scroll", toggleVisibility); + return () => window.removeEventListener("scroll", toggleVisibility); + }, []); + + const scrollToTop = () => { + window.scrollTo({ + top: 0, + behavior: "smooth", + }); + }; + + if (!isVisible) return null; + + return ( + + ); } \ No newline at end of file