"use client"; import React, { useState, useEffect } from 'react'; import Link from 'next/link'; import { Search, MapPin, ChevronLeft, ChevronRight, ArrowRight } from 'lucide-react'; interface HomeSlide { id: string; type: 'BUSINESS' | 'CUSTOM'; businessId?: string | null; business?: any; title?: string | null; subtitle?: string | null; imageUrl?: string | null; linkUrl?: string | null; coverPosition?: string | null; coverZoom?: number | null; } interface Props { slides: HomeSlide[]; onSearch: (searchTerm: string, locationTerm: string) => void; } const HomeSlider = ({ slides, onSearch }: Props) => { const [current, setCurrent] = useState(0); const [searchTerm, setSearchTerm] = useState(''); const [locationTerm, setLocationTerm] = useState(''); // Auto-slide every 6 seconds useEffect(() => { if (slides.length <= 1) return; const interval = setInterval(() => { setCurrent((prev) => (prev === slides.length - 1 ? 0 : prev + 1)); }, 6000); return () => clearInterval(interval); }, [slides.length]); const handleSearchSubmit = (e: React.FormEvent) => { e.preventDefault(); onSearch(searchTerm, locationTerm); }; // If no slides, show default hero if (slides.length === 0) { return (
L'annuaire 2.0 qui connecte les talents, les entrepreneurs et les entreprises de la diaspora et du continent.
{slide.type === 'BUSINESS' ? ( slide.business?.description ) : ( slide.subtitle )}