archive
lucide-animated-pqoqubbw/archiveFreeComponent
lucide-animated publishes no description for this item.
Install it
npx shadcn@latest add https://lucide-animated.com/r/archive.jsonSource
1"use client";23import type { Variants } from "motion/react";4import { motion, useAnimation } from "motion/react";5import type { HTMLAttributes } from "react";6import { forwardRef, useCallback, useImperativeHandle, useRef } from "react";78import { cn } from "@/lib/utils";910export interface ArchiveIconHandle {11 startAnimation: () => void;12 stopAnimation: () => void;13}1415interface ArchiveIconProps extends HTMLAttributes<HTMLDivElement> {16 size?: number;17}1819const RECT_VARIANTS: Variants = {20 normal: {21 translateY: 0,22 transition: {23 duration: 0.2,24 type: "spring",25 stiffness: 200,26 damping: 25,27 },28 },29 animate: {30 translateY: -1.5,31 transition: {32 duration: 0.2,33 type: "spring",34 stiffness: 200,35 damping: 25,36 },37 },38};3940const PATH_VARIANTS: Variants = {41 normal: { d: "M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8" },42 animate: { d: "M4 11v9a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V11" },43};4445const SECONDARY_PATH_VARIANTS: Variants = {46 normal: { d: "M10 12h4" },47 animate: { d: "M10 15h4" },48};4950const ArchiveIcon = forwardRef<ArchiveIconHandle, ArchiveIconProps>(51 ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {52 const controls = useAnimation();53 const isControlledRef = useRef(false);5455 useImperativeHandle(ref, () => {56 isControlledRef.current = true;5758 return {59 startAnimation: () => controls.start("animate"),60 stopAnimation: () => controls.start("normal"),61 };62 });6364 const handleMouseEnter = useCallback(65 (e: React.MouseEvent<HTMLDivElement>) => {66 if (isControlledRef.current) {67 onMouseEnter?.(e);68 } else {69 controls.start("animate");70 }71 },72 [controls, onMouseEnter]73 );7475 const handleMouseLeave = useCallback(76 (e: React.MouseEvent<HTMLDivElement>) => {77 if (isControlledRef.current) {78 onMouseLeave?.(e);79 } else {80 controls.start("normal");81 }82 },83 [controls, onMouseLeave]84 );8586 return (87 <div88 className={cn(className)}89 onMouseEnter={handleMouseEnter}90 onMouseLeave={handleMouseLeave}91 {...props}92 >93 <svg94 fill="none"95 height={size}96 stroke="currentColor"97 strokeLinecap="round"98 strokeLinejoin="round"99 strokeWidth="2"100 viewBox="0 0 24 24"101 width={size}102 xmlns="http://www.w3.org/2000/svg"103// … truncated
What it pulls in
npm packages
Files it writes
More from lucide-animated
All 464 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| a-arrow-downa-arrow-down | lucide-animated | Components | Free | 1 dep | |
| a-arrow-upa-arrow-up | lucide-animated | Components | Free | 1 dep | |
| accessibilityaccessibility | lucide-animated | Components | Free | 1 dep | |
| activityactivity | lucide-animated | Components | Free | 1 dep | |
| air-ventair-vent | lucide-animated | Components | Free | 1 dep | |
| airplaneairplane | lucide-animated | Components | Free | 1 dep | |
| airplayairplay | lucide-animated | Components | Free | 1 dep | |
| alarm-clockalarm-clock | lucide-animated | Components | Free | 1 dep |
