import React from 'react'; import { Button } from '../ui/button'; import { Badge } from '../ui/badge'; import { Avatar, AvatarFallback, AvatarImage } from '../ui/avatar'; import { Star, Clock, Users, Play, CheckCircle, Heart, BookOpen, ChevronRight, MoreHorizontal } from 'lucide-react'; import { Course } from '../../pages/learner/data/libraryData'; import { ImageWithFallback } from '../figma/ImageWithFallback'; import { useNavigate } from 'react-router-dom'; interface HorizontalCourseCardProps { course: Course; userType: 'individual' | 'corporate'; onEnroll?: (courseId: string) => void; onContinue?: (courseId: string) => void; onBookmark?: (courseId: string) => void; } // Course images based on course category const getCourseImage = (category: string) => { const patterns = { 'Leadership': (
), 'Personal Development': (
), 'Team Management': (
), 'Digital Leadership': (
), 'Communication': (
) }; return patterns[category as keyof typeof patterns] || patterns.Leadership; }; export function HorizontalCourseCard({ course, userType, onEnroll, onContinue, onBookmark }: HorizontalCourseCardProps) { const courseImage = getCourseImage(course.category); const navigate = useNavigate(); // Navigate to course details page with proper query parameters const handleCourseNavigation = () => { navigate(`/course?view=${userType}&courseId=${course.id}`); }; return (
{/* Left Image Section - 50% width, full height */}
{/* Course image overlay */} {courseImage} {/* Status indicators - Positioned better for larger image area */}
{course.isFeatured && ( Featured )} {course.isPremium && ( Premium )}
{/* Course status indicator */}
{course.status === 'completed' && (
)} {course.status === 'bookmarked' && (
)}
{/* Right Content Section - 50% width with increased spacing */}
{/* Top Content - Title and Description stay with original spacing */}
{/* Course Title - Increased to text-xl (20px) as requested */}

{course.title}

{/* Description with 8px spacing from title as requested */}

{course.description}

{/* Elements after description - Increased vertical spacing to 12px (space-y-3) */}
{/* Created by section - Updated font size for Avatar text */}
{course.instructor.name.split(' ').map(n => n[0]).join('')} Created by: {course.instructor.name}
{/* Badges below created by - Updated to text-sm (14px minimum) with brand colors */}
{course.level} {course.category}
{/* Combined lessons, duration, and rating section - All in one container */}
{/* Left side: Duration and Lessons */}
{course.duration}
{course.lessonsCount} lessons
{/* Right side: Rating stars */}
{[...Array(5)].map((_, i) => ( ))} {course.rating}
{/* Bottom Section - CTA buttons only with reduced spacing */}
{/* CTA buttons below everything else - wider for consistency */}
{course.status === 'not-started' && ( )} {course.status === 'in-progress' && ( )} {course.status === 'completed' && ( )} {course.status === 'bookmarked' && ( )} {/* Secondary action buttons - optimized sizing */}
); }