Innovación y Transformación en Salud
Transformando la salud con innovación y casos reales
Carousel
import { useEffect, useState } from "react";
import { Card, CardContent } from "@/components/ui/card";
import { Button } from "@/components/ui/button";
import { ChevronLeft, ChevronRight } from "lucide-react";
import { motion } from "framer-motion";
export default function NewsCarousel() {
const [articles, setArticles] = useState([]);
const [index, setIndex] = useState(0);
useEffect(() => {
// Simulación de fetch desde backend que transforma el feed de Google News en JSON
fetch("/api/news-feed") // Aquí deberías usar un backend proxy
.then((res) => res.json())
.then((data) => setArticles(data.items || []));
}, []);
const next = () => setIndex((prev) => (prev + 1) % articles.length);
const prev = () => setIndex((prev) => (prev - 1 + articles.length) % articles.length);
if (articles.length === 0) return
);
}
Cargando noticias...
; const article = articles[index]; return ({article.title}
{new Date(article.pubDate).toLocaleDateString()} - {article.source || "Google News"}
{article.description?.slice(0, 160)}...
Leer más