import { useState, useEffect } from 'react'; // Fading Image Component const FadingImage = ({ alt = "Fading image", className = "" }) => { const [isVisible, setIsVisible] = useState(true); const [shouldShow, setShouldShow] = useState(true); useEffect(() => { // Start fading out after 2 seconds const fadeTimer = setTimeout(() => { setIsVisible(false); }, 2000); // Remove from DOM after fade out completes const removeTimer = setTimeout(() => { setShouldShow(false); }, 3000); return () => { clearTimeout(fadeTimer); clearTimeout(removeTimer); }; }, []); if (!shouldShow) { return null; } return (
{alt}
); }; export default FadingImage;