Skip to content

Commit 2a89a58

Browse files
committed
Add subtle animations when adding/removing run tags in the test page
1 parent caa5bcf commit 2a89a58

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

apps/webapp/app/components/runs/v3/RunTagInput.tsx

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useCallback, useState, type KeyboardEvent } from "react";
2+
import { AnimatePresence, motion } from "framer-motion";
23
import { Input } from "~/components/primitives/Input";
34
import { RunTag } from "./RunTag";
45

@@ -71,9 +72,38 @@ export function RunTagInput({
7172

7273
{tags.length > 0 && (
7374
<div className="mt-1 flex flex-wrap items-center gap-1 text-xs">
74-
{tags.map((tag, i) => (
75-
<RunTag key={tag} tag={tag} action={{ type: "delete", onDelete: removeTag }} />
76-
))}
75+
<AnimatePresence mode="popLayout">
76+
{tags.map((tag, i) => (
77+
<motion.div
78+
key={tag}
79+
initial={{
80+
opacity: 0,
81+
scale: 0.8,
82+
}}
83+
animate={{
84+
opacity: 1,
85+
scale: 1,
86+
}}
87+
exit={{
88+
opacity: 0,
89+
scale: 0.7,
90+
y: -10,
91+
transition: {
92+
duration: 0.15,
93+
ease: "easeOut",
94+
},
95+
}}
96+
transition={{
97+
type: "spring",
98+
stiffness: 400,
99+
damping: 25,
100+
duration: 0.15,
101+
}}
102+
>
103+
<RunTag tag={tag} action={{ type: "delete", onDelete: removeTag }} />
104+
</motion.div>
105+
))}
106+
</AnimatePresence>
77107
</div>
78108
)}
79109
</div>

0 commit comments

Comments
 (0)