1
- " use client" ;
1
+ ' use client' ;
2
2
3
- import type { CSSProperties } from " react" ;
4
- import React , { useEffect , useId , useRef } from " react" ;
3
+ import type { CSSProperties } from ' react' ;
4
+ import React , { useEffect , useId , useRef } from ' react' ;
5
5
6
6
interface AuroraTextProps {
7
7
children : React . ReactNode ;
@@ -12,8 +12,8 @@ interface AuroraTextProps {
12
12
13
13
export function AuroraText ( {
14
14
children,
15
- className = "" ,
16
- colors = [ " #FF0080" , " #7928CA" , " #0070F3" , " #38bdf8" , " #a855f7" , " #2dd4bf" ] ,
15
+ className = '' ,
16
+ colors = [ ' #FF0080' , ' #7928CA' , ' #0070F3' , ' #38bdf8' , ' #a855f7' , ' #2dd4bf' ] ,
17
17
speed = 1 ,
18
18
} : AuroraTextProps ) {
19
19
const canvasRef = useRef < HTMLCanvasElement > ( null ) ;
@@ -66,9 +66,9 @@ export function AuroraText({
66
66
} ;
67
67
68
68
updateFontSize ( ) ;
69
- window . addEventListener ( " resize" , updateFontSize ) ;
69
+ window . addEventListener ( ' resize' , updateFontSize ) ;
70
70
71
- return ( ) => window . removeEventListener ( " resize" , updateFontSize ) ;
71
+ return ( ) => window . removeEventListener ( ' resize' , updateFontSize ) ;
72
72
} , [ className ] ) ;
73
73
74
74
// Update effect to set ready state after dimensions are computed
@@ -85,16 +85,16 @@ export function AuroraText({
85
85
} ;
86
86
87
87
updateDimensions ( ) ;
88
- window . addEventListener ( " resize" , updateDimensions ) ;
88
+ window . addEventListener ( ' resize' , updateDimensions ) ;
89
89
90
- return ( ) => window . removeEventListener ( " resize" , updateDimensions ) ;
90
+ return ( ) => window . removeEventListener ( ' resize' , updateDimensions ) ;
91
91
} , [ children , fontSize ] ) ;
92
92
93
93
useEffect ( ( ) => {
94
94
const canvas = canvasRef . current ;
95
95
if ( ! canvas ) return ;
96
96
97
- const ctx = canvas . getContext ( "2d" ) ;
97
+ const ctx = canvas . getContext ( '2d' ) ;
98
98
if ( ! ctx ) return ;
99
99
100
100
// Set canvas size
@@ -128,12 +128,12 @@ export function AuroraText({
128
128
0 ,
129
129
x ,
130
130
y ,
131
- canvas . width * 0.4 ,
131
+ canvas . width * 0.4
132
132
) ;
133
133
134
134
gradient . addColorStop ( 0 , `${ color } 99` ) ;
135
135
gradient . addColorStop ( 0.5 , `${ color } 33` ) ;
136
- gradient . addColorStop ( 1 , " #00000000" ) ;
136
+ gradient . addColorStop ( 1 , ' #00000000' ) ;
137
137
138
138
ctx . fillStyle = gradient ;
139
139
ctx . fillRect ( 0 , 0 , canvas . width , canvas . height ) ;
@@ -149,8 +149,8 @@ export function AuroraText({
149
149
ref = { containerRef }
150
150
className = { `relative inline-block align-middle ${ className } ` }
151
151
style = { {
152
- width : dimensions . width || " auto" ,
153
- height : dimensions . height || " auto" ,
152
+ width : dimensions . width || ' auto' ,
153
+ height : dimensions . height || ' auto' ,
154
154
} }
155
155
>
156
156
{ /* Hidden text for SEO */ }
@@ -160,10 +160,10 @@ export function AuroraText({
160
160
< span
161
161
style = { {
162
162
opacity : isReady ? 0 : 1 ,
163
- transition : " opacity 0.2s ease-in" ,
164
- position : isReady ? " absolute" : " relative" ,
165
- display : " inline-block" ,
166
- whiteSpace : " nowrap" ,
163
+ transition : ' opacity 0.2s ease-in' ,
164
+ position : isReady ? ' absolute' : ' relative' ,
165
+ display : ' inline-block' ,
166
+ whiteSpace : ' nowrap' ,
167
167
} }
168
168
aria-hidden = "true"
169
169
>
@@ -174,7 +174,7 @@ export function AuroraText({
174
174
className = "absolute inset-0"
175
175
style = { {
176
176
opacity : isReady ? 1 : 0 ,
177
- transition : " opacity 0.2s ease-in" ,
177
+ transition : ' opacity 0.2s ease-in' ,
178
178
} }
179
179
aria-hidden = "true"
180
180
>
0 commit comments