From 4bcdde8bae8f37f2523521a57709f8f8bd5e3a9d Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Fri, 10 Apr 2026 22:22:43 +0100 Subject: [PATCH] make it cool --- app/components/tvone-hero.tsx | 146 ++++++++++++++++++++++++---------- 1 file changed, 103 insertions(+), 43 deletions(-) diff --git a/app/components/tvone-hero.tsx b/app/components/tvone-hero.tsx index 7559439..6abd37e 100644 --- a/app/components/tvone-hero.tsx +++ b/app/components/tvone-hero.tsx @@ -1,76 +1,136 @@ "use client"; import Image from "next/image"; -import { useState } from "react"; +import { useState, useEffect } from "react"; const slides = [ { id: 1, tag: "MÚSICA", - title: - "Diddy na XB Label? Gerilson Israel responde após anúncio de lançamento de nova música em conjunto.", + title: "Diddy na XB Label? Gerilson Israel responde após anúncio de lançamento de nova música em conjunto.", byline: "Por Redação — 24 de Março, 2025", - image: - "https://images.unsplash.com/photo-1493225457124-a3eb161ffa5f?w=1400&q=80", + image: "https://images.unsplash.com/photo-1493225457124-a3eb161ffa5f?w=1400&q=80", }, { id: 2, tag: "CULTURA", title: "Festivais de verão: calendário completo e bilhetes à venda esta semana.", byline: "Por Equipa tvone — 23 de Março, 2025", - image: - "https://images.unsplash.com/photo-1459749411175-04bf5292ceea?w=1400&q=80", + image: "https://images.unsplash.com/photo-1459749411175-04bf5292ceea?w=1400&q=80", }, { id: 3, tag: "TV", title: "Novas séries internacionais chegam às plataformas — o que não pode perder.", byline: "Por Redação — 22 de Março, 2025", - image: - "https://images.unsplash.com/photo-1522869635100-9f4c5e86aa37?w=1400&q=80", + image: "https://images.unsplash.com/photo-1522869635100-9f4c5e86aa37?w=1400&q=80", }, ]; export function TvoneHero() { const [active, setActive] = useState(0); - const slide = slides[active]!; + const [isPaused, setIsPaused] = useState(false); + + // --- AUTO-PLAY LOGIC --- + useEffect(() => { + if (isPaused) return; + + const interval = setInterval(() => { + setActive((prev) => (prev + 1) % slides.length); + }, 3000); // 3 Seconds + + return () => clearInterval(interval); + }, [isPaused, active]); return ( -
-
-
- -
-
- - {slide.tag} - -

- {slide.title} -

-

{slide.byline}

-
-
-
- {slides.map((s, i) => ( - + ))} + +
); -} +} \ No newline at end of file