11"use client" ;
2- import React , { useState , useEffect , useRef } from "react" ;
2+ import React from "react" ;
33
44import { motion } from "framer-motion" ;
55import { cn } from "@/lib/utils" ;
66
7- type Direction = "TOP" | "LEFT" | "BOTTOM" | "RIGHT" ;
7+ // Removed Direction type as it's no longer needed
88
99export function HoverBorderGradient ( {
1010 children,
1111 containerClassName,
1212 className,
1313 as : Tag = "button" ,
14- duration = 1 ,
15- clockwise = true ,
1614 ...props
1715} : React . PropsWithChildren <
1816 {
1917 as ?: React . ElementType ;
2018 containerClassName ?: string ;
2119 className ?: string ;
22- duration ?: number ;
23- clockwise ?: boolean ;
2420 } & React . HTMLAttributes < HTMLElement >
2521> ) {
26- const [ hovered , setHovered ] = useState < boolean > ( false ) ;
27- const [ direction , setDirection ] = useState < Direction > ( "TOP" ) ;
28-
29- const rotateDirection = ( currentDirection : Direction ) : Direction => {
30- const directions : Direction [ ] = [ "TOP" , "LEFT" , "BOTTOM" , "RIGHT" ] ;
31- const currentIndex = directions . indexOf ( currentDirection ) ;
32- const nextIndex = clockwise
33- ? ( currentIndex - 1 + directions . length ) % directions . length
34- : ( currentIndex + 1 ) % directions . length ;
35- return directions [ nextIndex ] ;
36- } ;
37-
38- const movingMap : Record < Direction , string > = {
39- TOP : "radial-gradient(20.7% 50% at 50% 0%, hsl(0, 0%, 100%) 0%, rgba(255, 255, 255, 0) 100%)" ,
40- LEFT : "radial-gradient(16.6% 43.1% at 0% 50%, hsl(0, 0%, 100%) 0%, rgba(255, 255, 255, 0) 100%)" ,
41- BOTTOM :
42- "radial-gradient(20.7% 50% at 50% 100%, hsl(0, 0%, 100%) 0%, rgba(255, 255, 255, 0) 100%)" ,
43- RIGHT :
44- "radial-gradient(16.2% 41.199999999999996% at 100% 50%, hsl(0, 0%, 100%) 0%, rgba(255, 255, 255, 0) 100%)" ,
45- } ;
22+ // Simplified component - using red glow as permanent state
4623
4724 const highlight =
4825 "radial-gradient(75% 181.15942028985506% at 50% 50%, #EF4444 0%, rgba(255, 255, 255, 0) 100%)" ;
4926
50- useEffect ( ( ) => {
51- if ( ! hovered ) {
52- const interval = setInterval ( ( ) => {
53- setDirection ( ( prevState ) => rotateDirection ( prevState ) ) ;
54- } , duration * 1000 ) ;
55- return ( ) => clearInterval ( interval ) ;
56- }
57- } , [ hovered , duration , rotateDirection ] ) ;
27+ // Removed the moving gradient animation - using red glow as default state
5828 return (
5929 < Tag
60- onMouseEnter = { ( event : React . MouseEvent < HTMLDivElement > ) => {
61- setHovered ( true ) ;
62- } }
63- onMouseLeave = { ( ) => setHovered ( false ) }
6430 className = { cn (
6531 "relative flex rounded-full border content-center bg-black/20 hover:bg-black/10 transition duration-500 dark:bg-white/20 items-center flex-col flex-nowrap gap-10 h-min justify-center overflow-visible p-px decoration-clone w-fit" ,
6632 containerClassName
@@ -85,13 +51,11 @@ export function HoverBorderGradient({
8551 width : "100%" ,
8652 height : "100%" ,
8753 } }
88- initial = { { background : movingMap [ direction ] } }
54+ initial = { { background : highlight } }
8955 animate = { {
90- background : hovered
91- ? [ movingMap [ direction ] , highlight ]
92- : movingMap [ direction ] ,
56+ background : highlight ,
9357 } }
94- transition = { { ease : "linear" , duration : duration ?? 1 } }
58+ transition = { { ease : "linear" , duration : 1 } }
9559 />
9660 < div className = "bg-black absolute z-1 flex-none inset-[2px] rounded-[100px]" />
9761 </ Tag >
0 commit comments