-
Notifications
You must be signed in to change notification settings - Fork 95
/
battery-full.json
21 lines (21 loc) · 2.42 KB
/
battery-full.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
"name": "battery-full",
"type": "registry:ui",
"registryDependencies": [],
"dependencies": [
"motion"
],
"devDependencies": [],
"tailwind": {},
"cssVars": {
"light": {},
"dark": {}
},
"files": [
{
"path": "battery-full.tsx",
"content": "'use client';\n\nimport { type Variants, motion, useAnimation } from 'motion/react';\n\nconst lineVariants: Variants = {\n initial: { opacity: 1 },\n fadeOut: {\n opacity: 0,\n transition: {\n duration: 0.4,\n ease: 'easeInOut',\n },\n },\n fadeIn: (i: number) => ({\n opacity: 1,\n transition: {\n duration: 0.6,\n delay: i * 0.4,\n ease: 'easeInOut',\n },\n }),\n};\n\nconst BatteryFullIcon = () => {\n const controls = useAnimation();\n\n const handleHoverStart = async () => {\n await controls.start('fadeOut');\n controls.start('fadeIn');\n };\n\n const handleHoverEnd = () => {\n controls.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={handleHoverStart}\n onMouseLeave={handleHoverEnd}\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 >\n <rect width=\"16\" height=\"10\" x=\"2\" y=\"7\" rx=\"2\" ry=\"2\" />\n <line x1=\"22\" x2=\"22\" y1=\"11\" y2=\"13\" />\n <motion.line\n x1=\"6\"\n x2=\"6\"\n y1=\"11\"\n y2=\"13\"\n variants={lineVariants}\n initial=\"initial\"\n animate={controls}\n custom={0}\n />\n <motion.line\n x1=\"10\"\n x2=\"10\"\n y1=\"11\"\n y2=\"13\"\n variants={lineVariants}\n initial=\"initial\"\n animate={controls}\n custom={1}\n />\n <motion.line\n x1=\"14\"\n x2=\"14\"\n y1=\"11\"\n y2=\"13\"\n variants={lineVariants}\n initial=\"initial\"\n animate={controls}\n custom={2}\n />\n </motion.svg>\n </div>\n );\n};\n\nexport { BatteryFullIcon };\n",
"type": "registry:ui"
}
]
}