From 562fe1b5d542e9e3b42d3f30c48bf4ba6df0b9fd Mon Sep 17 00:00:00 2001 From: bender Date: Wed, 10 Jun 2026 10:40:52 +0000 Subject: [PATCH] Update src/components/ui/ButtonMagnetic.tsx --- src/components/ui/ButtonMagnetic.tsx | 69 ---------------------------- 1 file changed, 69 deletions(-) diff --git a/src/components/ui/ButtonMagnetic.tsx b/src/components/ui/ButtonMagnetic.tsx index 9d92e43..e69de29 100644 --- a/src/components/ui/ButtonMagnetic.tsx +++ b/src/components/ui/ButtonMagnetic.tsx @@ -1,69 +0,0 @@ -"use client"; - -import { useRef } from "react"; -import { motion, useMotionValue, useSpring } from "motion/react"; -import { useButtonClick } from "@/hooks/useButtonClick"; -import { cls } from "@/lib/utils"; - -interface ButtonMagneticProps { - text: string; - variant?: "primary" | "secondary"; - href?: string; - onClick?: () => void; - animate?: boolean; - animationDelay?: number; - className?: string; -} - -const ButtonMagnetic = ({ text, variant = "primary", href = "#", onClick, animate = true, animationDelay = 0, className = "" }: ButtonMagneticProps) => { - const handleClick = useButtonClick(href, onClick); - const ref = useRef(null); - - const x = useMotionValue(0); - const y = useMotionValue(0); - const springX = useSpring(x, { stiffness: 150, damping: 15 }); - const springY = useSpring(y, { stiffness: 150, damping: 15 }); - - const handleMouseMove = (e: React.MouseEvent) => { - if (!ref.current || window.innerWidth < 768) return; - const rect = ref.current.getBoundingClientRect(); - const offsetX = (e.clientX - rect.left - rect.width / 2) * 0.15; - const offsetY = (e.clientY - rect.top - rect.height / 2) * 0.15; - x.set(offsetX); - y.set(offsetY); - }; - - const handleMouseLeave = () => { - x.set(0); - y.set(0); - }; - - const button = ( - - {text} - - ); - - if (!animate) return button; - - return ( - - {button} - - ); -}; - -export default ButtonMagnetic;