-
Notifications
You must be signed in to change notification settings - Fork 95
/
github.json
21 lines (21 loc) · 2.66 KB
/
github.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
"name": "github",
"type": "registry:ui",
"registryDependencies": [],
"dependencies": [
"motion"
],
"devDependencies": [],
"tailwind": {},
"cssVars": {
"light": {},
"dark": {}
},
"files": [
{
"path": "github.tsx",
"content": "'use client';\n\nimport type { Variants } from 'motion/react';\nimport { motion, useAnimation } from 'motion/react';\n\nconst bodyVariants: Variants = {\n normal: {\n opacity: 1,\n pathLength: 1,\n scale: 1,\n transition: {\n duration: 0.3,\n },\n },\n animate: {\n opacity: [0, 1],\n pathLength: [0, 1],\n scale: [0.9, 1],\n transition: {\n duration: 0.4,\n },\n },\n};\n\nconst tailVariants: Variants = {\n normal: {\n pathLength: 1,\n rotate: 0,\n transition: {\n duration: 0.3,\n },\n },\n draw: {\n pathLength: [0, 1],\n rotate: 0,\n transition: {\n duration: 0.5,\n },\n },\n wag: {\n pathLength: 1,\n rotate: [0, -15, 15, -10, 10, -5, 5],\n transition: {\n duration: 2.5,\n ease: 'easeInOut',\n repeat: Infinity,\n },\n },\n};\n\nconst GithubIcon = () => {\n const bodyControls = useAnimation();\n const tailControls = useAnimation();\n\n const handleMouseEnter = async () => {\n bodyControls.start('animate');\n await tailControls.start('draw');\n tailControls.start('wag');\n };\n\n const handleMouseLeave = () => {\n bodyControls.start('normal');\n tailControls.start('normal');\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={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\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 variants={bodyVariants}\n initial=\"normal\"\n animate={bodyControls}\n d=\"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4\"\n />\n <motion.path\n variants={tailVariants}\n initial=\"normal\"\n animate={tailControls}\n d=\"M9 18c-4.51 2-5-2-7-2\"\n />\n </svg>\n </div>\n );\n};\n\nexport { GithubIcon };\n",
"type": "registry:ui"
}
]
}