"use client"; import { getListArticle } from "@/service/article"; import Image from "next/image"; import Link from "next/link"; import { useEffect, useState } from "react"; type Article = { id: number; title: string; description: string; categoryName: string; createdAt: string; createdByName: string; thumbnailUrl: string; categories: { title: string; }[]; files: { file_url: string; file_alt: string; }[]; }; const TravelNews = () => { const [page, setPage] = useState(1); const [totalPage, setTotalPage] = useState(1); const [articles, setArticles] = useState([]); const [showData, setShowData] = useState("4"); const [search, setSearch] = useState(""); const [selectedCategories, setSelectedCategories] = useState([]); const [startDateValue, setStartDateValue] = useState({ startDate: null, endDate: null, }); useEffect(() => { initState(); }, [page, showData, startDateValue, selectedCategories]); async function initState() { const req = { limit: showData, page, search, categorySlug: Array.from(selectedCategories).join(","), sort: "desc", isPublish: true, sortBy: "created_at", }; try { const res = await getListArticle(req); setArticles(res?.data?.data || []); setTotalPage(res?.data?.meta?.totalPage || 1); } catch (err) { console.error("Error fetching articles:", err); } } return (

Travel News

Find your best tour and start the adventure at the lowest budget and best experiences

{/* Top Featured News */}
{/* CARD 1 */} {articles.slice(0, 3).map((item) => (
{item.title}

{item.title}

{new Date(item.createdAt).toLocaleDateString("id-ID", { day: "2-digit", month: "long", year: "numeric", })}

))}
{/* Bottom News List */}
{[ "Your Guide to Canggu’s Hottest Street: The Essential Batu Bolong", "Expert Tips: How To Become A Professional Travel Blogger", "Important things you should know for Mount Agung hiking", "How to build a freelance career while traveling the world", "Bali Nightlife Guide : The most popular clubs in Kuta", "This English breakfast pie is maybe the most British thing ever", "Everything You Need to Know About Solo Travel", "10 things you didn’t know about being solo traveler in Asia", "Kehadiran Media Hub Polri Jadi Jawaban atas Kebutuhan Jurnalis Masa Kini", "Indonesia Tersingkir dari Piala Asia U-17 2025 Setelah Kalah Telak 6-0 dari Korea Utara", "Tayang Besok, Gen 99 Hospital Playlist Juga Jadi Cameo di Resident Playbook", "Tak Perpanjang Kontrak, Megawati Hengkang dari Red Sparks", ].map((item, idx) => (

{item}

))}
Berita Utama
); }; export default TravelNews;