import { Box } from "@mantine/core"; import { useEffect, useState } from "react"; import classes from "./WizardOverlay.module.css"; type WizardOverlayProps = { targetSelector: string; spotlightPadding?: number; }; const WizardOverlay = ({ targetSelector, spotlightPadding = 4, }: WizardOverlayProps) => { const [spotlightRect, setSpotlightRect] = useState(null); useEffect(() => { const updateSpotlight = () => { const targetElement = document.querySelector(targetSelector); if (targetElement) { const rect = targetElement.getBoundingClientRect(); setSpotlightRect(rect); } }; // Initial calculation updateSpotlight(); window.addEventListener("resize", updateSpotlight); window.addEventListener("scroll", updateSpotlight); return () => { window.removeEventListener("resize", updateSpotlight); window.removeEventListener("scroll", updateSpotlight); }; }, [targetSelector]); if (!spotlightRect) { return null; } return ( ); }; export { WizardOverlay };