mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-06-06 19:16:19 +00:00
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 9m52s
fix: update sidebar transition duration for smoother experience chore: update package dependencies and versions for improved stability and features
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
"use client";
|
|
|
|
import { useEffect, useState } from "react";
|
|
|
|
interface WelcomeBannerProps {
|
|
firstName?: string | null;
|
|
lastName?: string | null;
|
|
}
|
|
|
|
const ANIMATION_DURATION_MS = 500;
|
|
export function WelcomeBanner({ firstName, lastName }: WelcomeBannerProps) {
|
|
const [isMounted, setIsMounted] = useState(true);
|
|
const [isFadingOut, setIsFadingOut] = useState(false);
|
|
|
|
useEffect(() => {
|
|
const startFadeOutTimer = setTimeout(() => {
|
|
setIsFadingOut(true);
|
|
}, 3000);
|
|
const unmountTimer = setTimeout(() => {
|
|
setIsMounted(false);
|
|
}, 3000 + ANIMATION_DURATION_MS);
|
|
|
|
return () => {
|
|
clearTimeout(startFadeOutTimer);
|
|
clearTimeout(unmountTimer);
|
|
};
|
|
}, []);
|
|
|
|
if (!isMounted) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<div
|
|
className={`text-sm font-mono px-2 p-1 bg-green-500/10 text-green-900 dark:text-green-400 ${isFadingOut ? "animate-out fade-out animate-duration-500 animate-ease-out" : "animate-in fade-in"
|
|
}`}
|
|
>
|
|
Welcome,{" "}
|
|
<span className="font-semibold">
|
|
{firstName} {lastName}
|
|
</span>
|
|
</div>
|
|
);
|
|
} |