History (add/ remove) favorites add remove done
This commit is contained in:
19
frontend/src/components/FloatingAlert.jsx
Normal file
19
frontend/src/components/FloatingAlert.jsx
Normal file
@@ -0,0 +1,19 @@
|
||||
// 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 (
|
||||
<div className="fixed top-4 left-1/2 transform -translate-x-1/2 bg-green-500 text-white px-4 py-2 rounded-xl shadow-lg z-50 text-center">
|
||||
{message}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
export default FloatingAlert;
|
||||
Reference in New Issue
Block a user