"use client"; import Image from "next/image"; import { useState } from "react"; const allArticles = Array.from({ length: 20 }, (_, i) => ({ title: [ "Operasi Keselamatan Musi 2024: Ditlantas Polda Sumsel Himbau Keselamatan de...", "Gelar Operasi Semeru, Kanit Lantas Gencarkan Sosialisasi Keselamatan Berken...", "Kapolsek Sooko sambang dunia pendidikan berikan himbauan kamtibmas di MTS S...", "PATROLI DIALOGIS POLSEK GONDANG TINGKATKAN KEWASPADAAN SEKITAR KEPADA SATPAM", ][i % 4], date: "07-03-2024, 07:55", image: `/images/article${(i % 4) + 1}.jpg`, })); const articlesPerPage = 4; const totalPages = Math.ceil(allArticles.length / articlesPerPage); export default function DashboardRecentArticles() { const [currentPage, setCurrentPage] = useState(1); const paginatedArticles = allArticles.slice( (currentPage - 1) * articlesPerPage, currentPage * articlesPerPage ); return (
{article.date}