"use client";

import { useEffect, useState } from "react";

export default function Footer() {
  const [isTop, setIsTop] = useState(true);

  useEffect(() => {
    const onScroll = () => setIsTop(window.scrollY <= 0);
    onScroll();
    window.addEventListener("scroll", onScroll, { passive: true });
    return () => window.removeEventListener("scroll", onScroll);
  }, []);

  return (
    <footer className={isTop ? "sticky-footer" : "sticky-footer is-visible"}>
      <p>© 2025 - Toine</p>
    </footer>
  );
}
