import React, { useState } from 'react'; import { Box, Typography, Button, Fade, Paper, useTheme, useMediaQuery } from '@mui/material'; import ArrowForwardIcon from '@mui/icons-material/ArrowForward'; import { TimelineItemProps } from './types'; import MasonryGrid from './MasonryGrid'; const TimelineItem: React.FC = ({ item, orientation, isVisible = true, index }) => { const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down('sm')); const [isHovered, setIsHovered] = useState(false); // Force vertical orientation on mobile const effectiveOrientation = isMobile ? 'vertical' : orientation; // Determine if this item should be on the left or right (for vertical orientation) // or top or bottom (for horizontal orientation) const isAlternating = index % 2 === 1; // Enhanced glow effects for the marker - using deep dark blue with stronger glow const markerGlowEffects = { boxShadow: isHovered ? '0 0 15px rgba(10, 25, 50, 0.6), 0 0 30px rgba(10, 25, 50, 0.5)' : '0 0 10px rgba(10, 25, 50, 0.5), 0 0 20px rgba(10, 25, 50, 0.4)', filter: isHovered ? 'drop-shadow(0 4px 8px rgba(10, 25, 50, 0.6))' : 'drop-shadow(0 2px 4px rgba(10, 25, 50, 0.5))', transition: 'all 0.3s ease-in-out', }; // Subtle shadow for the content without white glow const contentShadowEffects = { boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)', transition: 'all 0.3s ease-in-out', }; // Enhanced button hover effects - using darker blue glow const buttonHoverEffects = { boxShadow: '0 0 10px rgba(10, 25, 50, 0.5), 0 0 20px rgba(10, 25, 50, 0.4)', filter: 'drop-shadow(0 2px 4px rgba(10, 25, 50, 0.5))', '&:hover': { transform: 'translateX(5px)', boxShadow: '0 0 15px rgba(10, 25, 50, 0.6), 0 0 30px rgba(10, 25, 50, 0.5)', filter: 'drop-shadow(0 4px 8px rgba(10, 25, 50, 0.6))', }, transition: 'all 0.3s ease-in-out', }; // Render the timeline marker const renderMarker = () => ( {item.date} {/* Line connecting to the next item */} {effectiveOrientation === 'vertical' ? ( ) : ( )} ); // Render the content section const renderContent = () => ( {item.title} {item.description} {item.actionUrl && ( )} ); // Layout for vertical orientation if (effectiveOrientation === 'vertical') { return ( setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} > {/* For alternating layout on desktop */} {!isMobile && isAlternating ? ( <> {renderContent()} {renderMarker()} {/* Empty space for alignment */} ) : ( <> {/* Empty space for alignment */} {renderMarker()} {renderContent()} )} ); } // Layout for horizontal orientation return ( setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} > {isAlternating ? ( <> {renderMarker()} {renderContent()} ) : ( <> {renderContent()} {renderMarker()} )} ); }; export default TimelineItem;