UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
fix: add flickering grid rounded demo
Dillion Verma62875bef052d
diff --git a/content/docs/components/flickering-grid.mdx b/content/docs/components/flickering-grid.mdxindex 65ed5f1f..9a4f9e34 100644--- a/content/docs/components/flickering-grid.mdx+++ b/content/docs/components/flickering-grid.mdx@@ -40,6 +40,12 @@ npx magicui-cli add flickering-grid</Tabs>+## Examples++### Rounded++<ComponentPreview name="flickering-grid-rounded-demo" />+## Props| Prop | Type | Description | Default |diff --git a/registry/components/example/flickering-grid-demo.tsx b/registry/components/example/flickering-grid-demo.tsxindex 064e298a..db7b1c19 100644--- a/registry/components/example/flickering-grid-demo.tsx+++ b/registry/components/example/flickering-grid-demo.tsx@@ -3,16 +3,7 @@ import FlickeringGrid from "@/components/magicui/flickering-grid";export default function FlickeringGridDemo() {return (<div className="relative h-[500px] rounded-lg w-full bg-background overflow-hidden border">- <FlickeringGrid- className="z-0 absolute inset-0 size-full"- squareSize={4}- gridGap={6}- color="#6B7280"- maxOpacity={0.5}- flickerChance={0.1}- height={800}- width={800}- />+ <FlickeringGrid height={800} width={800} /></div>);}diff --git a/registry/components/example/flickering-grid-rounded-demo.tsx b/registry/components/example/flickering-grid-rounded-demo.tsxnew file mode 100644index 00000000..11db41eb--- /dev/null+++ b/registry/components/example/flickering-grid-rounded-demo.tsx@@ -0,0 +1,18 @@+import FlickeringGrid from "@/components/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 absolute inset-0 [mask:radial-gradient(circle_at_center,#fff_300px,transparent_0)]"+ squareSize={4}+ gridGap={6}+ color="#60A5FA"+ maxOpacity={0.5}+ flickerChance={0.1}+ height={800}+ width={800}+ />+ </div>+ );+}diff --git a/registry/components/magicui/flickering-grid.tsx b/registry/components/magicui/flickering-grid.tsxindex 4ef68450..a3110526 100644--- a/registry/components/magicui/flickering-grid.tsx+++ b/registry/components/magicui/flickering-grid.tsx@@ -27,7 +27,7 @@ const FlickeringGrid: React.FC<FlickeringGridProps> = ({width,height,className,- maxOpacity = 0.2,+ maxOpacity = 0.3,}) => {const canvasRef = useRef<HTMLCanvasElement>(null);const [isInView, setIsInView] = useState(false);@@ -75,7 +75,7 @@ const FlickeringGrid: React.FC<FlickeringGridProps> = ({dpr,};},- [squareSize, gridGap, width, height, maxOpacity]+ [squareSize, gridGap, width, height, maxOpacity],);const updateSquares = useCallback(@@ -86,7 +86,7 @@ const FlickeringGrid: React.FC<FlickeringGridProps> = ({}}},- [flickerChance, maxOpacity]+ [flickerChance, maxOpacity],);const drawGrid = useCallback(@@ -97,7 +97,7 @@ const FlickeringGrid: React.FC<FlickeringGridProps> = ({cols: number,rows: number,squares: Float32Array,- dpr: number+ dpr: number,) => {ctx.clearRect(0, 0, width, height);ctx.fillStyle = "transparent";@@ -111,12 +111,12 @@ const FlickeringGrid: React.FC<FlickeringGridProps> = ({i * (squareSize + gridGap) * dpr,j * (squareSize + gridGap) * dpr,squareSize * dpr,- squareSize * dpr+ squareSize * dpr,);}}},- [memoizedColor, squareSize, gridGap]+ [memoizedColor, squareSize, gridGap],);useEffect(() => {@@ -149,7 +149,7 @@ const FlickeringGrid: React.FC<FlickeringGridProps> = ({([entry]) => {setIsInView(entry.isIntersecting);},- { threshold: 0 }+ { threshold: 0 },);observer.observe(canvas);diff --git a/registry/index.tsx b/registry/index.tsxindex 1ed6ad01..568af1b0 100644--- a/registry/index.tsx+++ b/registry/index.tsx@@ -337,6 +337,15 @@ const example: Registry = {() => import("@/registry/components/example/flickering-grid-demo"),),},+ "flickering-grid-rounded-demo": {+ name: "flickering-grid",+ type: "components:example",+ files: ["registry/components/example/flickering-grid-rounded-demo.tsx"],+ component: React.lazy(+ () =>+ import("@/registry/components/example/flickering-grid-rounded-demo"),+ ),+ },"marquee-demo": {name: "marquee-demo",type: "components:example",