2025-04-13 12:52:21 -06:00
|
|
|
// components/FloatingAlert.jsx
|
|
|
|
|
import { useEffect } from "react";
|
|
|
|
|
|
|
|
|
|
const FloatingAlert = ({ message, onClose, duration = 3000 }) => {
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const timer = setTimeout(() => {
|
|
|
|
|
onClose();
|
|
|
|
|
}, duration);
|
|
|
|
|
|
|
|
|
|
return () => clearTimeout(timer);
|
|
|
|
|
}, [onClose, duration]);
|
|
|
|
|
|
|
|
|
|
return (
|
2025-04-21 22:46:39 -06:00
|
|
|
<div className="fixed top-4 left-1/2 transform -translate-x-1/2 bg-emerald-600 text-white px-4 py-2 rounded-xl shadow-lg z-50 text-center">
|
2025-04-13 12:52:21 -06:00
|
|
|
{message}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
export default FloatingAlert;
|