I’m working with a booking widget from the react-calendly package in my Next.js application. I’ve successfully integrated the popup functionality, but I’m facing an issue with the trigger button placement.
Here’s my current implementation:
"use client";
import { Calendar } from "lucide-react";
import Price from "@/components/ui/price";
import ActionButton from "@/components/ui/action-button";
import { Service } from "@/types";
import useBooking from "@/hooks/use-booking";
import { PopupWidget } from "react-calendly";
interface ServiceInfoProps {
service: Service
};
const ServiceInfo: React.FC<ServiceInfoProps> = ({ service }) => {
const booking = useBooking();
const handleBookingAdd = () => {
booking.addService(service);
}
return (
<div id="main-container">
<h2 className="text-3xl font-bold text-gray-900">{service.title}</h2>
<div className="mt-3 flex items-end justify-between">
<p className="text-2xl text-gray-900">
Starting at <Price amount={service?.cost} />
</p>
</div>
<hr className="my-4" />
<div className="flex flex-col gap-y-6">
<div className="flex items-center gap-x-4">
<h3 className="font-semibold text-black">Details:</h3>
<p className="text-lg text-gray-900">
{service.fullDescription}
</p>
<div>
{service?.duration?.label}
</div>
</div>
</div>
<div className="mt-10 flex items-center gap-x-3">
<ActionButton onClick={handleBookingAdd} className="flex items-center gap-x-2">
Book Service
<Calendar size={20} />
</ActionButton>
<PopupWidget
url="https://calendly.com/myservice"
rootElement={document.getElementById("main-container")!}
text="Schedule consultation now!"
textColor="#ffffff"
color="#059669"
/>
</div>
</div>
);
}
export default ServiceInfo;
The issue I’m encountering is that the scheduling button automatically appears in the bottom right corner of the screen by default. I need it to stay inline with my other action buttons instead of floating in that fixed position. How can I override this default positioning behavior?