Files
sarlink-portal/components/welcome-banner.tsx
i701 a60e9a9c85
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 12m20s
chore: add skeletons to tables and loading.tsx files for routes and run formatting ♻️
2025-09-20 20:42:14 +05:00

40 lines
925 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-slide-down inline-block motion-delay-200">
{firstName} {lastName}
</p>
</motion.div>
)}
</AnimatePresence>
);
}