MCPcopy Create free account
hub / github.com/benjitaylor/agentation / CopyButton

Function CopyButton

package/example/src/app/components/CodeBlock.tsx:7–204  ·  view source on GitHub ↗
({ text }: { text: string })

Source from the content-addressed store, hash-verified

5import { motion, useAnimate, type AnimationSequence } from "framer-motion";
6
7function CopyButton({ text }: { text: string }) {
8 const [copied, setCopied] = useState(false);
9 const [scope, animate] = useAnimate();
10 const maskId = useId();
11
12 const inSequence: AnimationSequence = [
13 [
14 '[data-part="square-front"]',
15 { y: [0, -4] },
16 { duration: 0.12, ease: "easeOut" },
17 ],
18 [
19 '[data-part="square-back"]',
20 { x: [0, -4] },
21 { at: "<", duration: 0.12, ease: "easeOut" },
22 ],
23 [
24 '[data-part="square-front"], [data-part="square-back"]',
25 {
26 rx: [2, 7.25],
27 width: [10.5, 14.5],
28 height: [10.5, 14.5],
29 rotate: [0, -45],
30 },
31 { at: "<", duration: 0.12, ease: "easeOut" },
32 ],
33 [
34 '[data-part="check"]',
35 { opacity: [0, 1], pathOffset: [1, 0] },
36 { at: "-0.03", duration: 0 },
37 ],
38 ['[data-part="check"]', { pathLength: [0, 1] }, { duration: 0.1 }],
39 ];
40
41 const outSequence: AnimationSequence = [
42 [
43 '[data-part="check"]',
44 { pathOffset: [0, 1] },
45 { duration: 0.1, ease: "easeOut" },
46 ],
47 [
48 '[data-part="check"]',
49 { opacity: [1, 0], pathLength: [1, 0] },
50 { duration: 0 },
51 ],
52 [
53 '[data-part="square-front"], [data-part="square-back"]',
54 {
55 rx: [7.25, 2],
56 width: [14.5, 10.5],
57 height: [14.5, 10.5],
58 rotate: [-45, 0],
59 },
60 { at: "+0.03", duration: 0.12, ease: "easeOut" },
61 ],
62 [
63 '[data-part="square-front"]',
64 { y: [-4, 0] },

Callers

nothing calls this directly

Calls 2

animateInFunction · 0.70
animateOutFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…