- {/* Nomor Urut */}
-
- {String(i + 2).padStart(2, "0")}
-
-
- {/* Judul & Info */}
-
-
- {a.title}
-
-
-
{154 - i} Shares
+
+
+ {/* Nomor Urut */}
+
+ {String(i + 2).padStart(2, "0")}
-
+
+ {/* Judul & Info */}
+
+
+ {a.title}
+
+
+ {154 - i} Shares
+
+
+
))}
diff --git a/components/landing-page/headers.tsx b/components/landing-page/headers.tsx
index 3343842..ca3b99b 100644
--- a/components/landing-page/headers.tsx
+++ b/components/landing-page/headers.tsx
@@ -5,6 +5,7 @@ import { useEffect, useState } from "react";
import Image from "next/image";
import { Calendar } from "lucide-react";
import { getListArticle } from "@/service/article";
+import Link from "next/link";
type Article = {
id: number;
@@ -72,38 +73,40 @@ export default function Header() {
key={article.id}
className="relative h-[438px] md:h-[438px] overflow-hidden"
>
- {/* Background Image */}
-
+
+ {/* Background Image */}
+
- {/* Overlay Warna */}
-
+ {/* Overlay Warna */}
+
- {/* Content */}
-
-
- {category.toUpperCase()}
-
-
- {article.title}
-
-
-
- {new Date(article.createdAt).toLocaleDateString("en-GB", {
- day: "2-digit",
- month: "long",
- year: "numeric",
- })}
+ {/* Content */}
+
+
+ {category.toUpperCase()}
+
+
+ {article.title}
+
+
+
+ {new Date(article.createdAt).toLocaleDateString("en-GB", {
+ day: "2-digit",
+ month: "long",
+ year: "numeric",
+ })}
+
-
+
);
})}
diff --git a/components/landing-page/news.tsx b/components/landing-page/news.tsx
index f6704f6..45bf0c3 100644
--- a/components/landing-page/news.tsx
+++ b/components/landing-page/news.tsx
@@ -3,6 +3,8 @@
import React, { useEffect, useState } from "react";
import Image from "next/image";
import { getListArticle } from "@/service/article";
+import Link from "next/link";
+import { usePathname } from "next/navigation";
type Article = {
id: number;
@@ -24,7 +26,19 @@ type Article = {
export default function BumnNews() {
const [articles, setArticles] = useState
([]);
const [popular, setPopular] = useState([]);
- const [categoryName, setCategoryName] = useState("Bumn News");
+ const pathname = usePathname(); // ⬅️ "/bumn-news" misalnya
+ const categoryName =
+ pathname
+ .split("/")
+ .filter(Boolean)
+ .pop()
+ ?.replace(/-/g, " ") // ubah slug jadi teks rapi
+ ?.replace(/\b\w/g, (c) => c.toUpperCase()) || "News";
+
+ useEffect(() => {
+ fetchArticles();
+ fetchPopular();
+ }, []);
useEffect(() => {
fetchArticles();
@@ -84,30 +98,35 @@ export default function BumnNews() {
{categoryName}
{/* Item pertama tampil besar */}
-
-
-
- {popular[0]?.title}
-
-
- 01
-
-
+
+
+
+
+ {popular[0]?.title}
+
+
+ 01
+
+
+
{/* Item sisanya */}
{popular.slice(1).map((item, i) => (
-
-
- 0{i + 2}
-
-
-
- {item.title}
-
-
0 Shares
-
+
+
+
+ 0{i + 2}
+
+
+
+ {item.title}
+
+
0 Shares
+
+
))}