Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

fix: unexpected decimal results in currentPercent calculation (#411)

Arghya Das3abec2e75cd9
diff --git a/registry/default/example/flickering-grid-rounded-demo.tsx b/registry/default/example/flickering-grid-rounded-demo.tsx
index bb98d82c..a31f3fa2 100644
--- a/registry/default/example/flickering-grid-rounded-demo.tsx
+++ b/registry/default/example/flickering-grid-rounded-demo.tsx
@@ -3,16 +3,16 @@ import FlickeringGrid from "@/registry/default/magicui/flickering-grid";
export default function FlickeringGridRoundedDemo() {
return (
<div className="relative size-[600px] rounded-lg w-full bg-background overflow-hidden border">
- <FlickeringGrid
- className="z-0 relative inset-0 [mask-image:radial-gradient(450px_circle_at_center,white,transparent)]"
- squareSize={4}
- gridGap={6}
- color="#60A5FA"
- maxOpacity={0.5}
- flickerChance={0.1}
- height={800}
- width={800}
- />
+ <FlickeringGrid
+ className="z-0 relative inset-0 [mask-image:radial-gradient(450px_circle_at_center,white,transparent)]"
+ squareSize={4}
+ gridGap={6}
+ color="#60A5FA"
+ maxOpacity={0.5}
+ flickerChance={0.1}
+ height={800}
+ width={800}
+ />
</div>
);
}
diff --git a/registry/default/magicui/animated-circular-progress-bar.tsx b/registry/default/magicui/animated-circular-progress-bar.tsx
index fcf964a9..979644be 100644
--- a/registry/default/magicui/animated-circular-progress-bar.tsx
+++ b/registry/default/magicui/animated-circular-progress-bar.tsx
@@ -19,7 +19,7 @@ export default function AnimatedCircularProgressBar({
}: Props) {
const circumference = 2 * Math.PI * 45;
const percentPx = circumference / 100;
- const currentPercent = ((value - min) / (max - min)) * 100;
+ const currentPercent = Math.round(((value - min) / (max - min)) * 100);
return (
<div
diff --git a/registry/default/magicui/text-reveal.tsx b/registry/default/magicui/text-reveal.tsx
index 164bc035..3d0d647d 100644
--- a/registry/default/magicui/text-reveal.tsx
+++ b/registry/default/magicui/text-reveal.tsx
@@ -70,4 +70,4 @@ const Word: FC<WordProps> = ({ children, progress, range }) => {
);
};
-export default TextRevealByWord;
\ No newline at end of file
+export default TextRevealByWord;