Skip to content

Commit 01f4f74

Browse files
committed
fix type error
1 parent f68f186 commit 01f4f74

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

web/src/components/ui/terminal/glitch-text.tsx

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ export function GlitchText({
1919
const [glitchText, setGlitchText] = useState(children)
2020

2121
const glitchChars = '!@#$%^&*(){}[]<>?/\\|~`'
22-
22+
2323
useEffect(() => {
2424
if (triggerOnMount) {
2525
setIsGlitching(true)
2626
const timer = setTimeout(() => setIsGlitching(false), 200)
2727
return () => clearTimeout(timer)
2828
}
29+
return
2930
}, [triggerOnMount])
3031

3132
useEffect(() => {
@@ -50,15 +51,16 @@ export function GlitchText({
5051
return char
5152
})
5253
.join('')
53-
54+
5455
setGlitchText(glitched)
5556
}, 50)
5657

5758
return () => clearInterval(interval)
5859
}, [isGlitching, children, glitchIntensity])
5960

6061
const handleMouseEnter = () => {
61-
if (Math.random() < 0.15) { // 15% chance on hover
62+
if (Math.random() < 0.15) {
63+
// 15% chance on hover
6264
setIsGlitching(true)
6365
setTimeout(() => setIsGlitching(false), 150)
6466
}
@@ -72,15 +74,19 @@ export function GlitchText({
7274
className
7375
)}
7476
onMouseEnter={handleMouseEnter}
75-
animate={isGlitching ? {
76-
x: [0, -1, 1, 0],
77-
textShadow: [
78-
'0 0 0px rgba(255,0,0,0)',
79-
'2px 0 0px rgba(255,0,0,0.8)',
80-
'-2px 0 0px rgba(0,255,255,0.8)',
81-
'0 0 0px rgba(255,0,0,0)',
82-
]
83-
} : {}}
77+
animate={
78+
isGlitching
79+
? {
80+
x: [0, -1, 1, 0],
81+
textShadow: [
82+
'0 0 0px rgba(255,0,0,0)',
83+
'2px 0 0px rgba(255,0,0,0.8)',
84+
'-2px 0 0px rgba(0,255,255,0.8)',
85+
'0 0 0px rgba(255,0,0,0)',
86+
],
87+
}
88+
: {}
89+
}
8490
transition={{ duration: 0.1, repeat: isGlitching ? 2 : 0 }}
8591
>
8692
{glitchText}
@@ -89,4 +95,4 @@ export function GlitchText({
8995
}
9096

9197
// Usage example:
92-
// <GlitchText triggerOnMount>Codebuff CLI v1.5.0</GlitchText>
98+
// <GlitchText triggerOnMount>Codebuff CLI v1.5.0</GlitchText>

0 commit comments

Comments
 (0)