-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy pathcart.json
21 lines (21 loc) · 2.08 KB
/
cart.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
"name": "cart",
"type": "registry:ui",
"registryDependencies": [],
"dependencies": [
"motion"
],
"devDependencies": [],
"tailwind": {},
"cssVars": {
"light": {},
"dark": {}
},
"files": [
{
"path": "cart.tsx",
"content": "'use client';\n\nimport type { Variants } from 'motion/react';\nimport { motion, useAnimation } from 'motion/react';\n\nconst lidVariants: Variants = {\n normal: { y: 0 },\n animate: { y: -1.1 },\n};\n\nconst cartVariants: Variants = {\n normal: { scale: 1 },\n hover: {\n scale: 1.1,\n y: [0, -5, 0],\n transition: {\n duration: 0.3,\n ease: 'easeInOut',\n y: { repeat: 1, delay: 0.1, duration: 0.4 },\n },\n },\n};\n\nconst springTransition = {\n type: 'spring',\n stiffness: 500,\n damping: 30,\n};\n\nconst CartIcon = () => {\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('hover');\n }}\n onMouseLeave={() => {\n controls.start('normal');\n }}\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={cartVariants}\n animate={controls}\n transition={{ duration: 0.2 }}\n >\n <motion.path\n d=\"M6.29977 5H21L19 12H7.37671M20 16H8L6 3H3M9 20C9 20.5523 8.55228 21 8 21C7.44772 21 7 20.5523 7 20C7 19.4477 7.44772 19 8 19C8.55228 19 9 19.4477 9 20ZM20 20C20 20.5523 19.5523 21 19 21C18.4477 21 18 20.5523 18 20C18 19.4477 18.4477 19 19 19C19.5523 19 20 19.4477 20 20Z\"\n variants={lidVariants}\n animate={controls}\n transition={springTransition}\n />\n </motion.svg>\n </div>\n );\n};\n\nexport { CartIcon };\n",
"type": "registry:ui"
}
]
}