"use client"; import { useRef, type CSSProperties, type PointerEvent, type ReactNode, } from "react"; import { motion, useReducedMotion, type HTMLMotionProps } from "framer-motion"; import "./SpotlightCard.css"; type SpotlightCardProps = Omit< HTMLMotionProps<"article">, "children" | "onMouseLeave" | "onPointerMove" | "onPointerLeave" | "style" > & { children: ReactNode; className?: string; spotlightColor?: string; style?: CSSProperties; }; export default function SpotlightCard({ children, className = "", spotlightColor = "rgba(255, 255, 255, 0.095)", style, ...props }: SpotlightCardProps) { const cardRef = useRef(null); const shouldReduceMotion = useReducedMotion(); function handlePointerMove(event: PointerEvent) { if (shouldReduceMotion || event.pointerType === "touch") return; const card = cardRef.current; if (!card) return; const bounds = card.getBoundingClientRect(); card.style.setProperty("--spotlight-x", `${event.clientX - bounds.left}px`); card.style.setProperty("--spotlight-y", `${event.clientY - bounds.top}px`); card.style.setProperty("--spotlight-visible", "1"); } function handlePointerLeave() { cardRef.current?.style.setProperty("--spotlight-visible", "0"); } return ( ); }