"use client"; import styles from "./HeroSplit.module.css"; import Link from "next/link"; import { heroSectionsData } from "../data/hero-sections"; export default function HeroSplit({ dict, currentLang }: { dict: any; currentLang: string }) { const handleMouseEnter = (e: React.MouseEvent, videoId?: string) => { if (videoId) { const iframe = e.currentTarget.querySelector('iframe'); if (iframe?.contentWindow) { iframe.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*'); } } }; const handleMouseLeave = (e: React.MouseEvent, videoId?: string) => { if (videoId) { const iframe = e.currentTarget.querySelector('iframe'); if (iframe?.contentWindow) { iframe.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*'); } } }; const mapDataToDict = heroSectionsData.map(item => { // @ts-ignore const translation = dict.sections[item.key] || {}; return { ...item, title: translation.title || item.title, subtitle: translation.subtitle || item.subtitle } }); return (
{mapDataToDict.map((section, index) => (
handleMouseEnter(e, section.videoId)} onMouseLeave={(e) => handleMouseLeave(e, section.videoId)} > {section.videoId ? (
{/* The background overlay thumbnail ensuring video loads smoothly behind */}
{/* The background overlay thumbnail ensuring YouTube UI is hidden until hover */}
) : (
)}

{section.title}

{section.subtitle}

{dict.nav.discover}
{section.socials.instagram && ( )} {section.socials.twitter && ( )} {section.socials.facebook && ( )}
))}
); }