"use client";

import Image from "next/image";

type ScrollToTopButtonProps = {
  icon: string;
  alt: string;
};

export default function ScrollToTopButton({ icon, alt }: ScrollToTopButtonProps) {
  const handleScrollTop = () => {
    window.scrollTo({
      top: 0,
      behavior: "smooth",
    });
  };

  return (
    <button id="scrollTopBtn" onClick={handleScrollTop} type="button" aria-label="Scroll to top">
      <Image src={icon} alt={alt} width={20} height={20} />
    </button>
  );
}
