import { MinusIcon, PlusIcon, type LucideIcon } from 'lucide-react'; import { useEffect, useState } from 'react'; import { cn } from '../../lib/classname'; type CourseFeatureProps = { title: string; icon: LucideIcon; description: string; imgUrl?: string; }; export function CourseFeature(props: CourseFeatureProps) { const { title, icon: Icon, description, imgUrl } = props; const [isExpanded, setIsExpanded] = useState(false); const [isZoomed, setIsZoomed] = useState(false); useEffect(() => { function onScroll() { if (isZoomed) { setIsZoomed(false); } } window.addEventListener('scroll', onScroll); return () => window.removeEventListener('scroll', onScroll); }, [isZoomed]); return ( <> {isZoomed && (
{ setIsZoomed(false); setIsExpanded(false); }} className="fixed inset-0 z-[999] flex cursor-zoom-out items-center justify-center bg-black bg-opacity-75" > {title}
)}
setIsExpanded(false)} >
{isExpanded && (

{description}

{imgUrl && ( { setIsZoomed(true); setIsExpanded(false); }} src={imgUrl} alt={title} className="mt-4 h-auto pointer-events-none md:pointer-events-auto w-full cursor-zoom-in rounded-lg object-right-top" /> )}
)}
); }