-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy pathitalic.json
21 lines (21 loc) · 2.16 KB
/
italic.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
"name": "italic",
"type": "registry:ui",
"registryDependencies": [],
"dependencies": [
"motion"
],
"devDependencies": [],
"tailwind": {},
"cssVars": {
"light": {},
"dark": {}
},
"files": [
{
"path": "italic.tsx",
"content": "'use client';\n\nimport type { Variants } from 'motion/react';\nimport { motion, useAnimation } from 'motion/react';\n\nconst lineVariants: Variants = {\n normal: { pathLength: 1, opacity: 1, pathOffset: 0 },\n animate: {\n pathLength: [0, 1],\n opacity: [0, 1],\n pathOffset: [1, 0],\n },\n};\n\nconst ItalicIcon = () => {\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.line\n transition={{ duration: 0.2 }}\n variants={lineVariants}\n animate={controls}\n x1=\"19\"\n x2=\"10\"\n y1=\"4\"\n y2=\"4\"\n />\n <motion.line\n transition={{ duration: 0.2 }}\n variants={lineVariants}\n animate={controls}\n x1=\"14\"\n x2=\"5\"\n y1=\"20\"\n y2=\"20\"\n />\n <motion.line\n transition={{\n delay: 0.1,\n duration: 0.4,\n }}\n variants={{\n normal: { pathLength: 1, pathOffset: 0 },\n animate: {\n pathLength: [0, 1],\n pathOffset: [1, 0],\n },\n }}\n animate={controls}\n x1=\"15\"\n x2=\"9\"\n y1=\"4\"\n y2=\"20\"\n />\n </svg>\n </div>\n );\n};\n\nexport { ItalicIcon };\n",
"type": "registry:ui"
}
]
}