-
Notifications
You must be signed in to change notification settings - Fork 95
/
languages.json
21 lines (21 loc) · 2.92 KB
/
languages.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
"name": "languages",
"type": "registry:ui",
"registryDependencies": [],
"dependencies": [
"motion"
],
"devDependencies": [],
"tailwind": {},
"cssVars": {
"light": {},
"dark": {}
},
"files": [
{
"path": "languages.tsx",
"content": "'use client';\n\nimport type { Variants } from 'motion/react';\nimport { motion, useAnimation } from 'motion/react';\n\nconst pathVariants: Variants = {\n initial: { opacity: 1, pathLength: 1, pathOffset: 0 },\n animate: (custom: number) => ({\n opacity: [0, 1],\n pathLength: [0, 1],\n pathOffset: [1, 0],\n transition: {\n opacity: { duration: 0.01, delay: custom * 0.1 },\n pathLength: {\n type: 'spring',\n duration: 0.5,\n bounce: 0,\n delay: custom * 0.1,\n },\n },\n }),\n};\n\nconst svgVariants: Variants = {\n initial: { opacity: 1 },\n animate: {\n opacity: 1,\n transition: {\n staggerChildren: 0.1,\n delayChildren: 0.2,\n },\n },\n};\n\nconst LanguagesIcon = () => {\n const svgControls = useAnimation();\n const pathControls = useAnimation();\n\n const onAnimationStart = () => {\n svgControls.start('animate');\n pathControls.start('animate');\n };\n\n const onAnimationEnd = () => {\n svgControls.start('initial');\n pathControls.start('initial');\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={onAnimationStart}\n onMouseLeave={onAnimationEnd}\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 variants={svgVariants}\n animate={svgControls}\n >\n <motion.path\n d=\"m5 8 6 6\"\n variants={pathVariants}\n custom={3}\n animate={pathControls}\n />\n <motion.path\n d=\"m4 14 6-6 3-3\"\n variants={pathVariants}\n custom={2}\n animate={pathControls}\n />\n <motion.path\n d=\"M2 5h12\"\n variants={pathVariants}\n custom={1}\n animate={pathControls}\n />\n <motion.path\n d=\"M7 2h1\"\n variants={pathVariants}\n custom={0}\n animate={pathControls}\n />\n <motion.path\n d=\"m22 22-5-10-5 10\"\n variants={pathVariants}\n custom={3}\n animate={pathControls}\n />\n <motion.path\n d=\"M14 18h6\"\n variants={pathVariants}\n custom={3}\n animate={pathControls}\n />\n </motion.svg>\n </div>\n );\n};\n\nexport { LanguagesIcon };\n",
"type": "registry:ui"
}
]
}