mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-18 20:14:44 +08:00
30 lines
682 B
TypeScript
30 lines
682 B
TypeScript
import { AnimatePresence, motion } from "motion/react";
|
|
|
|
import { cn } from "@/lib/utils";
|
|
|
|
export function FlipDisplay({
|
|
uniqueKey,
|
|
children,
|
|
className,
|
|
}: {
|
|
uniqueKey: string;
|
|
children: React.ReactNode;
|
|
className?: string;
|
|
}) {
|
|
return (
|
|
<div className={cn("relative overflow-hidden", className)}>
|
|
<AnimatePresence mode="wait">
|
|
<motion.div
|
|
key={uniqueKey}
|
|
initial={{ y: 8, opacity: 0 }}
|
|
animate={{ y: 2, opacity: 1 }}
|
|
exit={{ y: -8, opacity: 0 }}
|
|
transition={{ duration: 0.25, ease: [0.4, 0, 0.2, 1] }}
|
|
>
|
|
{children}
|
|
</motion.div>
|
|
</AnimatePresence>
|
|
</div>
|
|
);
|
|
}
|