Skip to content

Commit 02b4344

Browse files
naomiaroclaude
andcommitted
fix: clamp SVG rect height to prevent negative values in waveform decoration
Math.sin() * 20 can produce -20, making the total height negative when Math.random() contribution is small. SVG rect doesn't accept negative height values, causing console errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7877d13 commit 02b4344

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

website/src/pages/examples/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ const WaveformDecoration: React.FC<{ className?: string }> = ({ className }) =>
161161
</linearGradient>
162162
</defs>
163163
{[...Array(40)].map((_, i) => {
164-
const height = 10 + Math.sin(i * 0.5) * 20 + Math.random() * 15;
164+
const height = Math.max(2, 10 + Math.sin(i * 0.5) * 20 + Math.random() * 15);
165165
return (
166166
<rect
167167
key={i}

0 commit comments

Comments
 (0)