Files
demo-main-site/src/ui/components/menu/ReservationButton.tsx
Mojtaba Khorshidkolah 6c3b474873 first commit
2026-03-04 13:50:57 +03:30

38 lines
993 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use client";
import Link from "next/link";
import React, {useEffect, useState} from "react";
export default function ReservationButton({isSticky}: {isSticky: boolean}) {
const [show, setShow] = useState(false);
useEffect(() => {
const handleScroll = () => {
if (window.scrollY > 1000) {
setShow(true);
} else {
setShow(false);
}
};
window.addEventListener("scroll", handleScroll);
return () => window.removeEventListener("scroll", handleScroll);
}, []);
return (
<>
{show && (
<Link
href={"/contact-us#request_accept"}
dir="ltr"
className={`bg-secondary text-white rounded-full ${
isSticky ? "py-4 px-4" : "py-4 px-6"
} font-extrabold shadow-lg flex items-center whitespace-nowrap shadow-neutral-300 hover:shadow-none transition-all duration-200`}
>
دریافت
نوبت آنلاین
</Link>
)}
</>
);
}