-
Notifications
You must be signed in to change notification settings - Fork 95
/
ban.json
21 lines (21 loc) · 2.17 KB
/
ban.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
"name": "ban",
"type": "registry:ui",
"registryDependencies": [],
"dependencies": [
"motion"
],
"devDependencies": [],
"tailwind": {},
"cssVars": {
"light": {},
"dark": {}
},
"files": [
{
"path": "ban.tsx",
"content": "'use client';\n\nimport type { Variants } from 'motion/react';\nimport { motion, useAnimation } from 'motion/react';\n\nconst circleVariants: Variants = {\n normal: {\n opacity: 1,\n pathLength: 1,\n transition: {\n duration: 0.3,\n opacity: { duration: 0.1 },\n },\n },\n animate: {\n opacity: [0, 1],\n pathLength: [0, 1],\n transition: {\n duration: 0.4,\n opacity: { duration: 0.1 },\n },\n },\n};\n\nconst lineVariants: Variants = {\n normal: {\n opacity: 1,\n pathLength: 1,\n transition: {\n duration: 0.3,\n opacity: { duration: 0.1 },\n },\n },\n slash: () => ({\n opacity: [0, 1],\n pathLength: [0, 1],\n transition: {\n duration: 0.4,\n opacity: { duration: 0.1 },\n },\n }),\n};\n\nconst BanIcon = () => {\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={() => {\n controls.start('animate');\n controls.start('slash', { delay: 0.5 });\n }}\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.circle\n cx=\"12\"\n cy=\"12\"\n r=\"10\"\n variants={circleVariants}\n initial=\"normal\"\n animate={controls}\n />\n <motion.path\n d=\"m4.9 4.9 14.2 14.2\"\n variants={lineVariants}\n initial=\"normal\"\n animate={controls}\n />\n </svg>\n </div>\n );\n};\n\nexport { BanIcon };\n",
"type": "registry:ui"
}
]
}