11"use client" ; 
22
3- import  {   motion   }  from  "motion/react" ; 
3+ import  { motion }  from  "motion/react" ; 
44import  { 
55  ComponentPropsWithoutRef , 
66  useEffect , 
@@ -9,37 +9,36 @@ import {
99  useState , 
1010}  from  "react" ; 
1111
12- import  {   cn   }  from  "@/lib/utils" ; 
12+ import  { cn }  from  "@/lib/utils" ; 
1313
1414export  interface  AnimatedGridPatternProps 
1515  extends  ComponentPropsWithoutRef < "svg" >  { 
1616  width ?: number ; 
1717  height ?: number ; 
1818  x ?: number ; 
1919  y ?: number ; 
20-   strokeDasharray ?: any ; 
20+   strokeDasharray ?: string   |   number ; 
2121  numSquares ?: number ; 
2222  maxOpacity ?: number ; 
2323  duration ?: number ; 
2424  repeatDelay ?: number ; 
2525} 
2626
2727export  function  AnimatedGridPattern ( { 
28-   width =  40 , 
29-   height =  40 , 
30-   x =  - 1 , 
31-   y =  - 1 , 
32-   strokeDasharray =  0 , 
33-   numSquares =  50 , 
34-   className, 
35-   maxOpacity =  0.5 , 
36-   duration =  4 , 
37-   repeatDelay =  0.5 , 
38-   ...props 
39- } : AnimatedGridPatternProps )  { 
28+                                       width =  40 , 
29+                                       height =  40 , 
30+                                       x =  - 1 , 
31+                                       y =  - 1 , 
32+                                       strokeDasharray =  0 , 
33+                                       numSquares =  50 , 
34+                                       className, 
35+                                       maxOpacity =  0.5 , 
36+                                       duration =  4 , 
37+                                       ...props 
38+                                     } : AnimatedGridPatternProps )  { 
4039  const  id  =  useId ( ) ; 
4140  const  containerRef  =  useRef ( null ) ; 
42-   const  [ dimensions ,  setDimensions ]  =  useState ( {   width : 0 ,  height : 0   } ) ; 
41+   const  [ dimensions ,  setDimensions ]  =  useState ( { width : 0 ,  height : 0 } ) ; 
4342  const  [ squares ,  setSquares ]  =  useState ( ( )  =>  generateSquares ( numSquares ) ) ; 
4443
4544  function  getPos ( )  { 
@@ -51,7 +50,7 @@ export function AnimatedGridPattern({
5150
5251  // Adjust the generateSquares function to return objects with an id, x, and y 
5352  function  generateSquares ( count : number )  { 
54-     return  Array . from ( {   length : count   } ,  ( _ ,  i )  =>  ( { 
53+     return  Array . from ( { length : count } ,  ( _ ,  i )  =>  ( { 
5554      id : i , 
5655      pos : getPos ( ) , 
5756    } ) ) ; 
@@ -63,9 +62,9 @@ export function AnimatedGridPattern({
6362      currentSquares . map ( ( sq )  => 
6463        sq . id  ===  id 
6564          ? { 
66-                ...sq , 
67-                pos : getPos ( ) , 
68-              } 
65+             ...sq , 
66+             pos : getPos ( ) , 
67+           } 
6968          : sq , 
7069      ) , 
7170    ) ; 
@@ -81,7 +80,7 @@ export function AnimatedGridPattern({
8180  // Resize observer to update container dimensions 
8281  useEffect ( ( )  =>  { 
8382    const  resizeObserver  =  new  ResizeObserver ( ( entries )  =>  { 
84-       for  ( let  entry  of  entries )  { 
83+       for  ( const  entry  of  entries )  { 
8584        setDimensions ( { 
8685          width : entry . contentRect . width , 
8786          height : entry . contentRect . height , 
@@ -126,12 +125,12 @@ export function AnimatedGridPattern({
126125          /> 
127126        </ pattern > 
128127      </ defs > 
129-       < rect  width = "100%"  height = "100%"  fill = { `url(#${ id }  )` }   /> 
128+       < rect  width = "100%"  height = "100%"  fill = { `url(#${ id }  )` } /> 
130129      < svg  x = { x }  y = { y }  className = "overflow-visible" > 
131-         { squares . map ( ( {   pos : [ x ,  y ] ,  id  } ,  index )  =>  ( 
130+         { squares . map ( ( { pos : [ x ,  y ] ,  id} ,  index )  =>  ( 
132131          < motion . rect 
133-             initial = { {   opacity : 0   } } 
134-             animate = { {   opacity : maxOpacity   } } 
132+             initial = { { opacity : 0 } } 
133+             animate = { { opacity : maxOpacity } } 
135134            transition = { { 
136135              duration, 
137136              repeat : 1 , 
0 commit comments