-
Notifications
You must be signed in to change notification settings - Fork 95
/
clap.json
21 lines (21 loc) · 2.08 KB
/
clap.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
"name": "clap",
"type": "registry:ui",
"registryDependencies": [],
"dependencies": [
"motion"
],
"devDependencies": [],
"tailwind": {},
"cssVars": {
"light": {},
"dark": {}
},
"files": [
{
"path": "clap.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 originX: '4px',\n originY: '20px',\n },\n animate: {\n rotate: [-10, -10, 0],\n transition: {\n duration: 0.8,\n times: [0, 0.5, 1],\n ease: 'easeInOut',\n },\n },\n};\n\nconst clapVariants: Variants = {\n normal: {\n rotate: 0,\n originX: '3px',\n originY: '11px',\n },\n animate: {\n rotate: [0, -10, 16, 0],\n transition: {\n duration: 0.4,\n times: [0, 0.3, 0.6, 1],\n ease: 'easeInOut',\n },\n },\n};\n\nconst ClapIcon = () => {\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 style={{ overflow: 'visible' }}\n >\n <motion.g animate={controls} variants={variants}>\n <motion.g animate={controls} variants={clapVariants}>\n <path d=\"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z\" />\n <path d=\"m6.2 5.3 3.1 3.9\" />\n <path d=\"m12.4 3.4 3.1 4\" />\n </motion.g>\n <path d=\"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z\" />\n </motion.g>\n </svg>\n </div>\n );\n};\n\nexport { ClapIcon };\n",
"type": "registry:ui"
}
]
}