@@ -17,26 +17,26 @@ export function Pattern({
1717 let height = pattern . length * size + ( pattern . length - 1 ) * gapY
1818
1919 return (
20- < svg aria-hidden = "true" width = { width } height = { height } { ...props } >
20+ < svg aria-hidden = "true" width = { width } height = { height } className = { `overflow-visible ${ className || '' } ` . trim ( ) } { ...props } >
2121 < defs >
2222 < symbol id = { `${ id } -0` } width = { size } height = { size } >
23- < rect className = "fill-green-200 dark:fill-yellow-200" width = { size } height = { size } />
23+ < rect className = "fill-green-200 dark:fill-yellow-200 transition-colors duration-500 " width = { size } height = { size } />
2424 < circle
25- className = "fill-[#00843D] dark:fill-yellow-400"
25+ className = "fill-[#00843D] dark:fill-yellow-400 shadow-xl transition-colors duration-500 "
2626 cx = { size / 2 }
2727 cy = { size / 2 }
2828 r = { size * ( 13 / 40 ) }
2929 />
3030 </ symbol >
3131 < symbol id = { `${ id } -1` } width = { size } height = { size } >
3232 < circle
33- className = "fill-green-400 dark:fill-yellow-300 animate-pulse"
33+ className = "fill-green-300 dark:fill-yellow-300 animate-pulse transition-colors duration-500 "
3434 cx = { size / 2 }
3535 cy = { size / 2 }
3636 r = { size / 2 }
3737 />
3838 < rect
39- className = "fill-[#00843D] dark:fill-yellow-400"
39+ className = "fill-[#00843D] dark:fill-yellow-400 shadow-xl transition-colors duration-500 "
4040 width = { size / 2 }
4141 height = { size / 2 }
4242 x = { size / 4 }
@@ -45,14 +45,27 @@ export function Pattern({
4545 </ symbol >
4646 </ defs >
4747 { pattern . map ( ( row , rowIndex ) =>
48- row . map ( ( shape , columnIndex ) => (
49- < use
50- key = { `${ rowIndex } -${ columnIndex } ` }
51- href = { `#${ id } -${ shape } ` }
52- x = { columnIndex * size + columnIndex * gapX }
53- y = { rowIndex * size + rowIndex * gapY }
54- />
55- ) )
48+ row . map ( ( shape , columnIndex ) => {
49+ const x = columnIndex * size + columnIndex * gapX ;
50+ const y = rowIndex * size + rowIndex * gapY ;
51+
52+ // Determine a playful alternating rotation direction based on the grid index
53+ const hoverRotation = ( rowIndex + columnIndex ) % 2 === 0 ? "group-hover:rotate-[15deg]" : "group-hover:-rotate-[15deg]" ;
54+
55+ return (
56+ < g key = { `${ rowIndex } -${ columnIndex } ` } className = "group cursor-pointer" >
57+ { /* Invisible, static hit area to handle hover without flickering */ }
58+ < rect x = { x } y = { y } width = { size } height = { size } fill = "transparent" className = "pointer-events-auto" />
59+ < use
60+ href = { `#${ id } -${ shape } ` }
61+ x = { x }
62+ y = { y }
63+ style = { { transformOrigin : `${ x + size / 2 } px ${ y + size / 2 } px` } }
64+ className = { `transition-all duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)] group-hover:scale-[1.4] ${ hoverRotation } group-hover:drop-shadow-lg pointer-events-none` }
65+ />
66+ </ g >
67+ ) ;
68+ } )
5669 ) }
5770 </ svg >
5871 )
0 commit comments