UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
fix: improve pointer demo
Dillion Verma55b4d5ce4746
diff --git a/apps/www/public/r/pointer-demo-1.json b/apps/www/public/r/pointer-demo-1.jsonindex 67f809c5..4f0fa02a 100644--- a/apps/www/public/r/pointer-demo-1.json+++ b/apps/www/public/r/pointer-demo-1.json@@ -10,7 +10,7 @@"files": [{"path": "registry/example/pointer-demo-1.tsx",- "content": "\"use client\"\n\nimport { motion } from \"motion/react\"\n\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from \"@/components/ui/card\"\nimport { Pointer } from \"@/registry/magicui/pointer\"\n\nexport default function PointerDemo1() {\n return (\n <div className=\"grid grid-cols-1 gap-6 md:grid-cols-2 md:grid-rows-2\">\n <Card className=\"col-span-1 row-span-1 overflow-hidden border bg-gradient-to-br from-slate-50 to-slate-100 shadow-none transition-all dark:from-slate-900 dark:to-slate-800\">\n <CardHeader className=\"relative pb-2\">\n <CardTitle className=\"text-xl font-bold\">Animated Pointer</CardTitle>\n <CardDescription className=\"text-sm text-slate-600 dark:text-slate-400\">\n Animated pointer\n </CardDescription>\n </CardHeader>\n <CardContent className=\"relative flex h-40 items-center justify-center p-6\">\n <span className=\"pointer-events-none text-center text-xl font-medium text-slate-800 dark:text-slate-200\">\n Move your cursor here\n </span>\n </CardContent>\n <Pointer>\n <motion.div\n animate={{\n scale: [0.8, 1, 0.8],\n rotate: [0, 5, -5, 0],\n }}\n transition={{\n duration: 1.5,\n repeat: Infinity,\n ease: \"easeInOut\",\n }}\n >\n <svg\n width=\"40\"\n height=\"40\"\n viewBox=\"0 0 40 40\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"text-pink-600\"\n >\n <motion.path\n d=\"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z\"\n fill=\"currentColor\"\n animate={{ scale: [1, 1.2, 1] }}\n transition={{\n duration: 0.8,\n repeat: Infinity,\n ease: \"easeInOut\",\n }}\n />\n </svg>\n </motion.div>\n </Pointer>\n </Card>\n\n <Card className=\"col-span-1 row-span-1 overflow-hidden border bg-gradient-to-br from-blue-50 to-blue-100 shadow-none transition-all dark:from-blue-900 dark:to-blue-800\">\n <CardHeader className=\"relative pb-2\">\n <CardTitle className=\"text-xl font-bold\">Colored Pointer</CardTitle>\n <CardDescription className=\"text-sm text-blue-700 dark:text-blue-300\">\n A custom pointer with different color\n </CardDescription>\n </CardHeader>\n <CardContent className=\"relative flex h-40 items-center justify-center p-6\">\n <span className=\"pointer-events-none text-center text-xl font-medium text-blue-800 dark:text-blue-200\">\n Try me out\n </span>\n </CardContent>\n <Pointer className=\"fill-blue-500\" />\n </Card>\n\n <Card className=\"col-span-1 row-span-1 overflow-hidden border bg-gradient-to-br from-purple-50 to-purple-100 shadow-none transition-all dark:from-purple-900 dark:to-purple-800\">\n <CardHeader className=\"relative pb-2\">\n <CardTitle className=\"text-xl font-bold\">Custom Shape</CardTitle>\n <CardDescription className=\"text-sm text-purple-700 dark:text-purple-300\">\n A pointer with a custom SVG shape\n </CardDescription>\n </CardHeader>\n <CardContent className=\"relative flex h-40 items-center justify-center p-6\">\n <span className=\"pointer-events-none text-center text-xl font-medium text-purple-800 dark:text-purple-200\">\n Hover here\n </span>\n </CardContent>\n <Pointer>\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" className=\"fill-purple-500\" />\n <circle cx=\"12\" cy=\"12\" r=\"5\" className=\"fill-white\" />\n </svg>\n </Pointer>\n </Card>\n\n <Card className=\"col-span-1 row-span-1 overflow-hidden border bg-gradient-to-br from-green-50 to-green-100 shadow-none transition-all dark:from-green-900 dark:to-green-800\">\n <CardHeader className=\"relative pb-2\">\n <CardTitle className=\"text-xl font-bold\">Emoji Pointer</CardTitle>\n <CardDescription className=\"text-sm text-green-700 dark:text-green-300\">\n Using an emoji as a custom pointer\n </CardDescription>\n </CardHeader>\n <CardContent className=\"relative flex h-40 items-center justify-center p-6\">\n <span className=\"pointer-events-none text-center text-xl font-medium text-green-800 dark:text-green-200\">\n Check this out\n </span>\n </CardContent>\n <Pointer>\n <div className=\"text-2xl\">π</div>\n </Pointer>\n </Card>\n </div>\n )\n}\n",+ "content": "\"use client\"\n\nimport { motion } from \"motion/react\"\n\nimport { Pointer } from \"@/registry/magicui/pointer\"\n\nexport default function PointerDemo1() {\n return (\n <div className=\"grid grid-cols-1 gap-6 md:grid-cols-2 md:grid-rows-2\">\n <div className=\"border-border rounded-lg border p-4\">\n <div className=\"relative flex h-40 flex-col items-center justify-center\">\n <h3 className=\"text-xl font-semibold\">Animated Pointer</h3>\n <p className=\"text-muted-foreground text-sm\">Animated pointer</p>\n </div>\n <Pointer>\n <motion.div\n animate={{\n scale: [0.8, 1, 0.8],\n rotate: [0, 5, -5, 0],\n }}\n transition={{\n duration: 1.5,\n repeat: Infinity,\n ease: \"easeInOut\",\n }}\n >\n <svg\n width=\"40\"\n height=\"40\"\n viewBox=\"0 0 40 40\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"text-pink-600\"\n >\n <motion.path\n d=\"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z\"\n fill=\"currentColor\"\n animate={{ scale: [1, 1.2, 1] }}\n transition={{\n duration: 0.8,\n repeat: Infinity,\n ease: \"easeInOut\",\n }}\n />\n </svg>\n </motion.div>\n </Pointer>\n </div>\n\n <div className=\"border-border rounded-lg border p-4\">\n <div className=\"relative flex h-40 flex-col items-center justify-center\">\n <h3 className=\"text-xl font-semibold\">Colored Pointer</h3>\n <p className=\"text-muted-foreground text-sm\">\n A custom pointer with different color\n </p>\n </div>\n <Pointer className=\"fill-blue-500\" />\n </div>\n\n <div className=\"border-border rounded-lg border p-4\">\n <div className=\"relative flex h-40 flex-col items-center justify-center\">\n <h3 className=\"text-xl font-semibold\">Custom Shape</h3>\n <p className=\"text-muted-foreground text-sm\">\n A pointer with a custom SVG shape\n </p>\n </div>\n <Pointer>\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" className=\"fill-purple-500\" />\n <circle cx=\"12\" cy=\"12\" r=\"5\" className=\"fill-white\" />\n </svg>\n </Pointer>\n </div>\n\n <div className=\"border-border rounded-lg border p-4\">\n <div className=\"relative flex h-40 flex-col items-center justify-center\">\n <h3 className=\"text-xl font-semibold\">Emoji Pointer</h3>\n <p className=\"text-muted-foreground text-sm\">\n Using an emoji as a custom pointer\n </p>\n </div>\n <Pointer>\n <div className=\"text-2xl\">π</div>\n </Pointer>\n </div>\n </div>\n )\n}\n","type": "registry:example"}]diff --git a/apps/www/registry/example/pointer-demo-1.tsx b/apps/www/registry/example/pointer-demo-1.tsxindex f1acc16b..9965330e 100644--- a/apps/www/registry/example/pointer-demo-1.tsx+++ b/apps/www/registry/example/pointer-demo-1.tsx@@ -2,30 +2,16 @@import { motion } from "motion/react"-import {- Card,- CardContent,- CardDescription,- CardHeader,- CardTitle,-} from "@/components/ui/card"import { Pointer } from "@/registry/magicui/pointer"export default function PointerDemo1() {return (<div className="grid grid-cols-1 gap-6 md:grid-cols-2 md:grid-rows-2">- <Card className="col-span-1 row-span-1 overflow-hidden border bg-gradient-to-br from-slate-50 to-slate-100 shadow-none transition-all dark:from-slate-900 dark:to-slate-800">- <CardHeader className="relative pb-2">- <CardTitle className="text-xl font-bold">Animated Pointer</CardTitle>- <CardDescription className="text-sm text-slate-600 dark:text-slate-400">- Animated pointer- </CardDescription>- </CardHeader>- <CardContent className="relative flex h-40 items-center justify-center p-6">- <span className="pointer-events-none text-center text-xl font-medium text-slate-800 dark:text-slate-200">- Move your cursor here- </span>- </CardContent>+ <div className="border-border rounded-lg border p-4">+ <div className="relative flex h-40 flex-col items-center justify-center">+ <h3 className="text-xl font-semibold">Animated Pointer</h3>+ <p className="text-muted-foreground text-sm">Animated pointer</p>+ </div><Pointer><motion.divanimate={{@@ -59,35 +45,25 @@ export default function PointerDemo1() {</svg></motion.div></Pointer>- </Card>+ </div>- <Card className="col-span-1 row-span-1 overflow-hidden border bg-gradient-to-br from-blue-50 to-blue-100 shadow-none transition-all dark:from-blue-900 dark:to-blue-800">- <CardHeader className="relative pb-2">- <CardTitle className="text-xl font-bold">Colored Pointer</CardTitle>- <CardDescription className="text-sm text-blue-700 dark:text-blue-300">+ <div className="border-border rounded-lg border p-4">+ <div className="relative flex h-40 flex-col items-center justify-center">+ <h3 className="text-xl font-semibold">Colored Pointer</h3>+ <p className="text-muted-foreground text-sm">A custom pointer with different color- </CardDescription>- </CardHeader>- <CardContent className="relative flex h-40 items-center justify-center p-6">- <span className="pointer-events-none text-center text-xl font-medium text-blue-800 dark:text-blue-200">- Try me out- </span>- </CardContent>+ </p>+ </div><Pointer className="fill-blue-500" />- </Card>+ </div>- <Card className="col-span-1 row-span-1 overflow-hidden border bg-gradient-to-br from-purple-50 to-purple-100 shadow-none transition-all dark:from-purple-900 dark:to-purple-800">- <CardHeader className="relative pb-2">- <CardTitle className="text-xl font-bold">Custom Shape</CardTitle>- <CardDescription className="text-sm text-purple-700 dark:text-purple-300">+ <div className="border-border rounded-lg border p-4">+ <div className="relative flex h-40 flex-col items-center justify-center">+ <h3 className="text-xl font-semibold">Custom Shape</h3>+ <p className="text-muted-foreground text-sm">A pointer with a custom SVG shape- </CardDescription>- </CardHeader>- <CardContent className="relative flex h-40 items-center justify-center p-6">- <span className="pointer-events-none text-center text-xl font-medium text-purple-800 dark:text-purple-200">- Hover here- </span>- </CardContent>+ </p>+ </div><Pointer><svgwidth="24"@@ -100,24 +76,19 @@ export default function PointerDemo1() {<circle cx="12" cy="12" r="5" className="fill-white" /></svg></Pointer>- </Card>+ </div>- <Card className="col-span-1 row-span-1 overflow-hidden border bg-gradient-to-br from-green-50 to-green-100 shadow-none transition-all dark:from-green-900 dark:to-green-800">- <CardHeader className="relative pb-2">- <CardTitle className="text-xl font-bold">Emoji Pointer</CardTitle>- <CardDescription className="text-sm text-green-700 dark:text-green-300">+ <div className="border-border rounded-lg border p-4">+ <div className="relative flex h-40 flex-col items-center justify-center">+ <h3 className="text-xl font-semibold">Emoji Pointer</h3>+ <p className="text-muted-foreground text-sm">Using an emoji as a custom pointer- </CardDescription>- </CardHeader>- <CardContent className="relative flex h-40 items-center justify-center p-6">- <span className="pointer-events-none text-center text-xl font-medium text-green-800 dark:text-green-200">- Check this out- </span>- </CardContent>+ </p>+ </div><Pointer><div className="text-2xl">π</div></Pointer>- </Card>+ </div></div>)}