From 6b4d0be0a40c18f12ec200aaf00c31ad5ac919d1 Mon Sep 17 00:00:00 2001 From: Anang Yusman Date: Tue, 23 Sep 2025 10:37:12 +0800 Subject: [PATCH] update --- components/landing-page/footer.tsx | 285 +++++++++++++++++++---------- components/landing-page/navbar.tsx | 70 ++++++- components/landing-page/news.tsx | 4 +- public/adversment.png | Bin 0 -> 198239 bytes 4 files changed, 256 insertions(+), 103 deletions(-) create mode 100644 public/adversment.png diff --git a/components/landing-page/footer.tsx b/components/landing-page/footer.tsx index 3fd5f45..75ec946 100644 --- a/components/landing-page/footer.tsx +++ b/components/landing-page/footer.tsx @@ -1,105 +1,204 @@ "use client"; +import { useEffect, useState } from "react"; import Image from "next/image"; +import Link from "next/link"; +import { Calendar } from "lucide-react"; +import { getListArticle } from "@/service/article"; + +// Definisi type +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 }[]; +}; export default function Footer() { + const [articles, setArticles] = useState([]); + const [loading, setLoading] = useState(true); + + useEffect(() => { + fetchArticles(); + }, []); + + async function fetchArticles() { + try { + const req = { + limit: "2", // ambil 2 berita untuk recent news + page: 1, + search: "", + categorySlug: "", + sort: "desc", + isPublish: true, + sortBy: "created_at", + }; + + const res = await getListArticle(req); + setArticles(res?.data?.data || []); + } catch (error) { + console.error("Gagal memuat artikel:", error); + } finally { + setLoading(false); + } + } + return ( -