Skip to content

Commit 9a1a10f

Browse files
committed
fix: fix copy button icon fade-in
1 parent 3d5ae07 commit 9a1a10f

File tree

1 file changed

+5
-26
lines changed

1 file changed

+5
-26
lines changed

src/components/copy-button.tsx

+5-26
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"use client";
22

33
import React from "react";
4-
import { LayoutGroup, motion } from "framer-motion";
54
import { CheckIcon, CopyIcon } from "lucide-react";
65
import { Button } from "@/components/ui/button";
76
import { cn } from "@/utils/classes";
@@ -22,31 +21,11 @@ export const CopyButton = ({ code, className }: { code: string; className?: stri
2221
onClick={handleCopy}
2322
className={cn("h-8 w-8", className)}
2423
>
25-
<LayoutGroup>
26-
{copied ? (
27-
<motion.span
28-
layoutId="icon"
29-
key={0}
30-
initial={{ opacity: 0 }}
31-
animate={{ opacity: 1 }}
32-
exit={{ opacity: 0 }}
33-
transition={{ duration: 0.2 }}
34-
>
35-
<CheckIcon size={15} />
36-
</motion.span>
37-
) : (
38-
<motion.span
39-
layoutId="icon"
40-
key={1}
41-
initial={{ opacity: 0 }}
42-
animate={{ opacity: 1 }}
43-
exit={{ opacity: 0 }}
44-
transition={{ duration: 0.2 }}
45-
>
46-
<CopyIcon size={15} />
47-
</motion.span>
48-
)}
49-
</LayoutGroup>
24+
{copied ? (
25+
<CheckIcon size={15} className="animate-in fade-in" />
26+
) : (
27+
<CopyIcon size={15} className="animate-in fade-in" />
28+
)}
5029
</Button>
5130
);
5231
};

0 commit comments

Comments
 (0)