diff --git a/src/components/sections/hero.tsx b/src/components/sections/hero.tsx index 1bdac26..940c9d7 100644 --- a/src/components/sections/hero.tsx +++ b/src/components/sections/hero.tsx @@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react'; -import { AnimatePresence, motion } from 'motion/react'; import { ArrowRight } from 'lucide-react'; import { Button } from '@/components/ui/button'; @@ -39,6 +38,15 @@ const slides: HeroSlide[] = [ }, ]; +const SlideSummary = ({ slide }: { slide: HeroSlide }) => ( + <> +

{slide.title}

+ {slide.description && ( +

{slide.description}

+ )} + +); + interface SvgPath { path: string; height: number; @@ -114,9 +122,7 @@ const MaskedDiv: React.FC = ({ style={containerStyle} > {React.cloneElement(children, { - className: `w-full h-full object-cover transition-all duration-300 ${ - children.props.className || '' - }`, + className: `h-full w-full object-cover ${children.props.className || ''}`, })} ); @@ -126,11 +132,18 @@ export default function Hero() { const [currentIndex, setCurrentIndex] = useState(0); useEffect(() => { - const timer = setTimeout(() => { + slides.forEach((slide) => { + const image = new Image(); + image.src = slide.src; + }); + }, []); + + useEffect(() => { + const timer = window.setInterval(() => { setCurrentIndex((prevIndex) => (prevIndex + 1) % slides.length); }, 5000); - return () => clearTimeout(timer); - }, [currentIndex]); + return () => window.clearInterval(timer); + }, []); return (
@@ -161,71 +174,28 @@ export default function Hero() {
- - - + {slides[currentIndex].alt} {/* Top-right slide summary */}
- - - -

- {slides[currentIndex].title} -

- {slides[currentIndex].description && ( -

- {slides[currentIndex].description} -

- )} -
-
-
+
+ +
{/* Mobile: box below the image */}
- - -

- {slides[currentIndex].title} -

- {slides[currentIndex].description && ( -

- {slides[currentIndex].description} -

- )} -
-
+
+ +