diff --git a/src/components/TeaserCarousel.tsx b/src/components/TeaserCarousel.tsx index 6b4b00b..0fd59c6 100644 --- a/src/components/TeaserCarousel.tsx +++ b/src/components/TeaserCarousel.tsx @@ -15,66 +15,87 @@ type Slide = { const slides: Slide[] = [ { key: "compete", image: "/images/landing/compete_teaser.jpg", imageAlt: "Võistle", href: "/turniirid" }, - { key: "play", image: "/images/landing/play_teaser.png", imageAlt: "Mängi", href: "/piletid" }, - { key: "explore", image: "/images/landing/explore_teaser.png", imageAlt: "Avasta", href: "/messiala" }, + { key: "play", image: "/images/landing/play_teaser.png", imageAlt: "Mängi", href: "/piletid" }, + { key: "explore", image: "/images/landing/explore_teaser.png", imageAlt: "Avasta", href: "/messiala" }, ]; export default function TeaserCarousel() { const t = useTranslations("home.teaser"); const [current, setCurrent] = useState(0); - const slide = slides[current]; - const title = t(`${slide.key}.title`); - const description = t(`${slide.key}.description`); - const prize = t.raw(`${slide.key}.prize`) as string | null; + const prev = () => setCurrent((c) => (c - 1 + slides.length) % slides.length); + const next = () => setCurrent((c) => (c + 1) % slides.length); return (
- {/* Card */} + {/* Sliding track */}
- {/* Background image */} - {slide.imageAlt} - {/* Dark overlay */} -
+
+ {slides.map((slide) => { + const title = t(`${slide.key}.title`); + const description = t(`${slide.key}.description`); + const prize = t.raw(`${slide.key}.prize`) as string | null; - {/* Content grid */} -
- {/* Left: text */} -
-
-

- {t("heading")} -

- -

- {title} -

- -

- {description} -

-
- {prize && ( -

- {prize} -

- )} -
+ return ( +
+ {/* Background image */} + {slide.imageAlt} + {/* Gradient: dark on left, fades out on right */} +
- {/* Right: spacer (image shows through the overlay) */} -
+ {/* Content */} +
+
+
+

+ {t("heading")} +

+ +

+ {title} +

+ +

+ {description} +

+
+ {prize && ( +

+ {prize} +

+ )} +
+ {/* Right side: image shows through */} +
+
+
+ ); + })}
+ + {/* Arrow buttons */} + +
{/* Navigation dots */} @@ -84,9 +105,7 @@ export default function TeaserCarousel() { key={i} onClick={() => setCurrent(i)} className={`w-3 h-3 rounded-full transition ${ - i === current - ? "bg-[#007CAB]" - : "bg-[#1F5673] hover:bg-[#007CAB]/60" + i === current ? "bg-[#007CAB]" : "bg-[#1F5673] hover:bg-[#007CAB]/60" }`} aria-label={`Slide ${i + 1}`} />