Files
sarlink-portal/components/welcome-banner.tsx
i701 9ad1887f88
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 10m27s
refactor: add animations
2025-09-24 19:33:48 +05:00

40 lines
998 B
TypeScript

"use client";
import { AnimatePresence, motion } from "framer-motion";
import { useEffect, useState } from "react";
interface WelcomeBannerProps {
firstName?: string | null;
lastName?: string | null;
}
export function WelcomeBanner({ firstName, lastName }: WelcomeBannerProps) {
const [isVisible, setIsVisible] = useState(true);
useEffect(() => {
const timer = setTimeout(() => {
setIsVisible(false);
}, 4000);
return () => clearTimeout(timer);
}, []);
return (
<AnimatePresence>
{isVisible && (
<motion.div
className="text-sm font-mono px-2 p-1 bg-green-500/10 text-green-900 dark:text-green-400"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
>
Welcome,{" "}
<p className="font-semibold motion-preset-fade inline-block motion-delay-200">
{firstName} {lastName}
</p>
</motion.div>
)}
</AnimatePresence>
);
}