-
Notifications
You must be signed in to change notification settings - Fork 95
/
drum.json
21 lines (21 loc) · 1.89 KB
/
drum.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
"name": "drum",
"type": "registry:ui",
"registryDependencies": [],
"dependencies": [
"motion"
],
"devDependencies": [],
"tailwind": {},
"cssVars": {
"light": {},
"dark": {}
},
"files": [
{
"path": "drum.tsx",
"content": "'use client';\n\nimport type { Variants } from 'motion/react';\nimport { motion, useAnimation } from 'motion/react';\n\nconst variants: Variants = {\n normal: {\n rotate: 0,\n },\n animate: (custom: number) => ({\n rotate: custom === 1 ? [-10, 10, 0] : [10, -10, 0],\n transition: {\n delay: 0.1 * custom,\n repeat: Infinity,\n repeatType: 'reverse',\n duration: 0.5,\n },\n }),\n};\n\nconst DrumIcon = () => {\n const controls = useAnimation();\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={() => controls.start('animate')}\n onMouseLeave={() => controls.start('normal')}\n >\n <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 >\n <motion.path\n d=\"m2 2 8 8\"\n variants={variants}\n animate={controls}\n custom={1}\n />\n <motion.path\n d=\"m22 2-8 8\"\n variants={variants}\n animate={controls}\n custom={2}\n />\n <ellipse cx=\"12\" cy=\"9\" rx=\"10\" ry=\"5\" />\n <path d=\"M7 13.4v7.9\" />\n <path d=\"M12 14v8\" />\n <path d=\"M17 13.4v7.9\" />\n <path d=\"M2 9v8a10 5 0 0 0 20 0V9\" />\n </svg>\n </div>\n );\n};\n\nexport { DrumIcon };\n",
"type": "registry:ui"
}
]
}