-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy pathchart-scatter.json
21 lines (21 loc) · 2.62 KB
/
chart-scatter.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
"name": "chart-scatter",
"type": "registry:ui",
"registryDependencies": [],
"dependencies": [
"motion"
],
"devDependencies": [],
"tailwind": {},
"cssVars": {
"light": {},
"dark": {}
},
"files": [
{
"path": "chart-scatter.tsx",
"content": "'use client';\n\nimport { type Variants, motion, useAnimation } from 'motion/react';\n\nconst dotVariants: Variants = {\n visible: (i: number) => ({\n opacity: 1,\n transition: {\n delay: i * 0.15,\n duration: 0.3,\n },\n }),\n hidden: {\n opacity: 0,\n transition: {\n duration: 0.2,\n },\n },\n default: { opacity: 1 },\n};\n\nconst ChartScatterIcon = () => {\n const controls = useAnimation();\n\n const handleHoverStart = async () => {\n await controls.start('hidden');\n await controls.start('visible');\n };\n\n const handleHoverEnd = async () => {\n await controls.start('default');\n };\n\n return (\n <div\n className=\"cursor-pointer select-none p-2 hover:bg-accent rounded-md transition-colors duration-200 flex items-center justify-center\"\n onMouseEnter={handleHoverStart}\n onMouseLeave={handleHoverEnd}\n >\n <motion.svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"28\"\n height=\"28\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n initial=\"default\"\n animate={controls}\n >\n <motion.circle\n cx=\"7.5\"\n cy=\"7.5\"\n r=\".5\"\n variants={dotVariants}\n custom={0}\n fill=\"currentColor\"\n />\n <motion.circle\n cx=\"18.5\"\n cy=\"5.5\"\n r=\".5\"\n variants={dotVariants}\n custom={1}\n fill=\"currentColor\"\n />\n <motion.circle\n cx=\"11.5\"\n cy=\"11.5\"\n r=\".5\"\n variants={dotVariants}\n custom={2}\n fill=\"currentColor\"\n />\n <motion.circle\n cx=\"7.5\"\n cy=\"16.5\"\n r=\".5\"\n variants={dotVariants}\n custom={3}\n fill=\"currentColor\"\n />\n <motion.circle\n cx=\"17.5\"\n cy=\"14.5\"\n r=\".5\"\n variants={dotVariants}\n custom={4}\n fill=\"currentColor\"\n />\n <path d=\"M3 3v16a2 2 0 0 0 2 2h16\" strokeWidth=\"2\" />\n </motion.svg>\n </div>\n );\n};\n\nexport { ChartScatterIcon };\n",
"type": "registry:ui"
}
]
}