Compare commits
10 Commits
19e1b7dfbd
...
6ef0cc29a6
| Author | SHA1 | Date |
|---|---|---|
|
|
6ef0cc29a6 | |
|
|
58735a6343 | |
|
|
ce45ed8bdc | |
|
|
1b8ef91a72 | |
|
|
b287069d30 | |
|
|
40c79b9ae2 | |
|
|
2747e9fcd4 | |
|
|
f742115d96 | |
|
|
5bfdc59f83 | |
|
|
6270f23871 |
|
|
@ -11,12 +11,12 @@ build-dev:
|
|||
name: docker:25.0.3-cli
|
||||
services:
|
||||
- name: docker:25.0.3-dind
|
||||
command: ["--insecure-registry=103.82.242.92:8900"]
|
||||
command: ["--insecure-registry=38.47.185.86:8900"]
|
||||
script:
|
||||
- docker logout
|
||||
- docker login -u $DEPLOY_USERNAME -p $DEPLOY_TOKEN 103.82.242.92:8900
|
||||
- docker build -t 103.82.242.92:8900/medols/web-mikul-news:dev .
|
||||
- docker push 103.82.242.92:8900/medols/web-mikul-news:dev
|
||||
- docker login -u $DEPLOY_USERNAME -p $DEPLOY_TOKEN 38.47.185.86:8900
|
||||
- docker build -t 38.47.185.86:8900/medols/web-mikul-news:dev .
|
||||
- docker push 38.47.185.86:8900/medols/web-mikul-news:dev
|
||||
|
||||
auto-deploy:
|
||||
stage: deploy
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import Image from "next/image";
|
|||
export default function Development() {
|
||||
return (
|
||||
<div className="relative min-h-screen font-[family-name:var(--font-geist-sans)]">
|
||||
<div className="fixed top-0 left-0 w-full h-auto z-0">
|
||||
{/* <div className="fixed top-0 left-0 w-full h-auto z-0">
|
||||
<Image
|
||||
src="/rumput.jpg"
|
||||
alt="Background"
|
||||
|
|
@ -21,7 +21,7 @@ export default function Development() {
|
|||
className="w-full h-auto object-cover"
|
||||
priority
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div className="relative z-10 bg-[#F2F4F3] max-w-7xl mx-auto">
|
||||
<Navbar />
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import Image from "next/image";
|
|||
export default function Development() {
|
||||
return (
|
||||
<div className="relative min-h-screen font-[family-name:var(--font-geist-sans)]">
|
||||
<div className="fixed top-0 left-0 w-full h-auto z-0">
|
||||
{/* <div className="fixed top-0 left-0 w-full h-auto z-0">
|
||||
<Image
|
||||
src="/rumput.jpg"
|
||||
alt="Background"
|
||||
|
|
@ -17,7 +17,7 @@ export default function Development() {
|
|||
className="w-full h-auto object-cover"
|
||||
priority
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div className="relative z-10 bg-[#F2F4F3] max-w-7xl mx-auto">
|
||||
<Navbar />
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import Image from "next/image";
|
|||
export default function Development() {
|
||||
return (
|
||||
<div className="relative min-h-screen font-[family-name:var(--font-geist-sans)]">
|
||||
<div className="fixed top-0 left-0 w-full h-auto z-0">
|
||||
{/* <div className="fixed top-0 left-0 w-full h-auto z-0">
|
||||
<Image
|
||||
src="/rumput.jpg"
|
||||
alt="Background"
|
||||
|
|
@ -22,7 +22,7 @@ export default function Development() {
|
|||
className="w-full h-auto object-cover"
|
||||
priority
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div className="relative z-10 bg-[#F2F4F3] max-w-7xl mx-auto">
|
||||
<Navbar />
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import Image from "next/image";
|
|||
export default function Home() {
|
||||
return (
|
||||
<div className="relative min-h-screen font-[family-name:var(--font-geist-sans)]">
|
||||
<div className="fixed top-0 left-0 w-full h-auto z-0">
|
||||
{/* <div className="fixed top-0 left-0 w-full h-auto z-0">
|
||||
<Image
|
||||
src="/rumput.jpg"
|
||||
alt="Background"
|
||||
|
|
@ -15,7 +15,7 @@ export default function Home() {
|
|||
className="w-full h-auto object-cover"
|
||||
priority
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div className="relative z-10 bg-[#F2F4F3] max-w-7xl mx-auto">
|
||||
<Navbar />
|
||||
|
|
|
|||
41
app/page.tsx
41
app/page.tsx
|
|
@ -1,39 +1,26 @@
|
|||
import Author from "@/components/landing-page/author";
|
||||
import Footer from "@/components/landing-page/footer";
|
||||
import Header from "@/components/landing-page/header";
|
||||
import Latest from "@/components/landing-page/latest";
|
||||
import LatestandPopular from "@/components/landing-page/latest-and-popular";
|
||||
import Navbar from "@/components/landing-page/navbar";
|
||||
import News from "@/components/landing-page/news";
|
||||
import { id } from "date-fns/locale";
|
||||
import Image from "next/image";
|
||||
import LatestNews from "@/components/landing-page/latest-news";
|
||||
import Development from "@/components/landing-page/development";
|
||||
import OpinionNews from "@/components/landing-page/opinion-news";
|
||||
import NewsTerkini from "@/components/landing-page/health";
|
||||
import YouTubeSection from "@/components/landing-page/youtube-selection";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<div className="relative min-h-screen font-[family-name:var(--font-geist-sans)]">
|
||||
{/* Background fixed tidak ikut scroll */}
|
||||
<div className="fixed top-0 left-0 w-full h-auto z-0">
|
||||
<Image
|
||||
src="/rumput.jpg"
|
||||
alt="Background"
|
||||
width={1450}
|
||||
height={600}
|
||||
className="w-full h-auto object-cover"
|
||||
priority
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="relative z-10 bg-[#F2F4F3] max-w-6xl mx-auto">
|
||||
<Navbar />
|
||||
<div className="flex-1">
|
||||
<Header />
|
||||
</div>
|
||||
<Latest id={2} />
|
||||
<News />
|
||||
<Author />
|
||||
<LatestandPopular />
|
||||
<Footer />
|
||||
<Navbar />
|
||||
<div className="flex-1">
|
||||
<Header />
|
||||
</div>
|
||||
<LatestNews />
|
||||
<Development />
|
||||
<OpinionNews />
|
||||
<NewsTerkini />
|
||||
<YouTubeSection />
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import Link from "next/link";
|
|||
import {
|
||||
getArticleById,
|
||||
getArticleBySlug,
|
||||
getArticleFiles,
|
||||
getListArticle,
|
||||
} from "@/service/article";
|
||||
import { close, error, loading } from "@/config/swal";
|
||||
|
|
@ -22,6 +23,7 @@ import {
|
|||
import { useForm } from "react-hook-form";
|
||||
import { Badge } from "../ui/badge";
|
||||
import { map } from "zod";
|
||||
import { formatTextToHtmlTag } from "@/utils/global";
|
||||
|
||||
type TabKey = "trending" | "comments" | "latest";
|
||||
|
||||
|
|
@ -77,13 +79,15 @@ export default function DetailContent() {
|
|||
startDate: null,
|
||||
endDate: null,
|
||||
});
|
||||
const [detailfiles, setDetailFiles] = useState<any>([]);
|
||||
// const [detailfiles, setDetailFiles] = useState<any>([]);
|
||||
const [detailFiles, setDetailFiles] = useState<any[]>([]);
|
||||
|
||||
const [mainImage, setMainImage] = useState(0);
|
||||
const [thumbnail, setThumbnail] = useState("-");
|
||||
const [diseId, setDiseId] = useState(0);
|
||||
const [thumbnailImg, setThumbnailImg] = useState<File[]>([]);
|
||||
const [selectedMainImage, setSelectedMainImage] = useState<number | null>(
|
||||
null
|
||||
null,
|
||||
);
|
||||
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||
|
||||
|
|
@ -299,40 +303,48 @@ export default function DetailContent() {
|
|||
initStateData();
|
||||
}, [listCategory]);
|
||||
|
||||
useEffect(() => {
|
||||
setSelectedIndex(0);
|
||||
}, [detailFiles]);
|
||||
|
||||
async function initStateData() {
|
||||
loading();
|
||||
const res = await getArticleBySlug(slug);
|
||||
const data = res?.data?.data;
|
||||
try {
|
||||
// 1️⃣ Ambil artikel by slug
|
||||
const res = await getArticleBySlug(slug);
|
||||
const data = res?.data?.data;
|
||||
|
||||
setThumbnail(data?.thumbnailUrl);
|
||||
setDiseId(data?.aiArticleId);
|
||||
setDetailFiles(data?.files);
|
||||
setArticleDetail(data); // <-- Add this
|
||||
close();
|
||||
if (!data?.id) return;
|
||||
|
||||
setArticleDetail(data);
|
||||
setThumbnail(data.thumbnailUrl);
|
||||
setDiseId(data.aiArticleId);
|
||||
|
||||
// 2️⃣ Ambil SEMUA article files
|
||||
const filesRes = await getArticleFiles();
|
||||
const allFiles = filesRes?.data?.data ?? [];
|
||||
|
||||
// 3️⃣ FILTER sesuai articleId
|
||||
const filteredFiles = allFiles.filter(
|
||||
(file: any) => file.articleId === data.id,
|
||||
);
|
||||
|
||||
setDetailFiles(filteredFiles);
|
||||
} catch (error) {
|
||||
console.error("Init state detail error:", error);
|
||||
} finally {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
// if (!articleDetail?.files || articleDetail?.files?.length === 0) {
|
||||
// return (
|
||||
// <div className="w-full h-[400px] bg-gray-100 flex items-center justify-center rounded-lg">
|
||||
// <p className="text-gray-400 text-sm">Gambar tidak tersedia</p>
|
||||
// </div>
|
||||
// );
|
||||
// }
|
||||
function decodeHtmlString(raw: string = "") {
|
||||
if (!raw) return "";
|
||||
function removeImgTags(htmlString?: { __html: string }) {
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(String(htmlString?.__html), "text/html");
|
||||
|
||||
// 1️⃣ Hapus newline escape, backslash, dsb
|
||||
let decoded = raw
|
||||
.replace(/\\n/g, "\n")
|
||||
.replace(/\\"/g, '"') // ubah \" jadi "
|
||||
.replace(/\\'/g, "'") // ubah \' jadi '
|
||||
.replace(/\\\\/g, "\\") // ubah \\ jadi \
|
||||
.trim();
|
||||
const images = doc.querySelectorAll("img");
|
||||
images.forEach((img) => img.remove());
|
||||
|
||||
// 2️⃣ Decode entity HTML (misal ")
|
||||
const el = document.createElement("textarea");
|
||||
el.innerHTML = decoded;
|
||||
return el.value;
|
||||
return { __html: doc.body.innerHTML };
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
@ -379,53 +391,50 @@ export default function DetailContent() {
|
|||
</span>
|
||||
<span>•</span>
|
||||
<span>
|
||||
<span>
|
||||
{new Date(articleDetail?.publishedAt).toLocaleDateString(
|
||||
"id-ID",
|
||||
{
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
}
|
||||
)}
|
||||
</span>
|
||||
{new Date(articleDetail?.publishedAt ?? articleDetail?.createdAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
</span>
|
||||
|
||||
<span>•</span>
|
||||
<span>{articleDetail?.categories?.[0]?.title}</span>
|
||||
</div>
|
||||
|
||||
<div className="w-full h-auto mb-6">
|
||||
{/* Gambar utama */}
|
||||
{articleDetail?.files && articleDetail.files.length > 0 ? (
|
||||
{detailFiles.length > 0 ? (
|
||||
<>
|
||||
{/* Gambar utama */}
|
||||
<div className="w-full">
|
||||
<Image
|
||||
src={articleDetail.files[selectedIndex]?.fileUrl}
|
||||
alt={
|
||||
articleDetail.files[selectedIndex]?.fileAlt || "Berita"
|
||||
}
|
||||
width={800}
|
||||
height={400}
|
||||
className="rounded-lg w-full object-cover"
|
||||
/>
|
||||
</div>
|
||||
<Image
|
||||
src={detailFiles[selectedIndex]?.fileUrl}
|
||||
alt={detailFiles[selectedIndex]?.fileAlt || "Berita"}
|
||||
width={800}
|
||||
height={400}
|
||||
className="rounded-lg w-full object-cover"
|
||||
/>
|
||||
|
||||
{/* Thumbnail */}
|
||||
<div className="flex gap-2 mt-3 overflow-x-auto">
|
||||
{articleDetail.files.map((file: any, index: number) => (
|
||||
{detailFiles.map((file, index) => (
|
||||
<button
|
||||
key={file?.id || index}
|
||||
key={file.id}
|
||||
onClick={() => setSelectedIndex(index)}
|
||||
className={`border-2 rounded-lg overflow-hidden ${
|
||||
className={`border-2 rounded-lg ${
|
||||
selectedIndex === index
|
||||
? "border-red-500"
|
||||
: "border-transparent"
|
||||
}`}
|
||||
>
|
||||
<Image
|
||||
src={file?.fileUrl}
|
||||
alt={file?.fileAlt || "Thumbnail"}
|
||||
src={file.fileUrl}
|
||||
alt={file.fileAlt || "Thumbnail"}
|
||||
width={100}
|
||||
height={80}
|
||||
className="object-cover"
|
||||
|
|
@ -435,9 +444,8 @@ export default function DetailContent() {
|
|||
</div>
|
||||
</>
|
||||
) : (
|
||||
// Jika file kosong/null tapi tetap render data lainnya
|
||||
<div className="w-full h-[400px] bg-gray-100 flex items-center justify-center rounded-lg">
|
||||
<p className="text-gray-400 text-sm">Gambar tidak tersedia</p>
|
||||
<div className="h-[400px] flex items-center justify-center bg-gray-100 rounded-lg">
|
||||
<p className="text-gray-400">Gambar tidak tersedia</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
|
@ -515,11 +523,10 @@ export default function DetailContent() {
|
|||
<div className="flex-1 overflow-y-auto">
|
||||
<div className="prose max-w-none text-justify">
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: decodeHtmlString(
|
||||
articleDetail?.htmlDescription || ""
|
||||
),
|
||||
}}
|
||||
dangerouslySetInnerHTML={removeImgTags(
|
||||
formatTextToHtmlTag(articleDetail?.htmlDescription),
|
||||
)}
|
||||
className="text-sm lg:text-xl lg:leading-8 text-justify space-y-4"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// components/custom-editor.js
|
||||
|
||||
import React from "react";
|
||||
import React, { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { CKEditor } from "@ckeditor/ckeditor5-react";
|
||||
|
||||
import "@/styles/custom-editor.css";
|
||||
import Editor from "@/vendor/ckeditor5/build/ckeditor";
|
||||
|
||||
function CustomEditor(props) {
|
||||
|
|
@ -47,7 +47,7 @@ function CustomEditor(props) {
|
|||
padding: 1rem;
|
||||
}
|
||||
p {
|
||||
margin: 0.5em 0;
|
||||
margin: 0.5em 0 !important;
|
||||
}
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
margin: 1em 0 0.5em 0;
|
||||
|
|
@ -72,98 +72,6 @@ function CustomEditor(props) {
|
|||
},
|
||||
}}
|
||||
/>
|
||||
<style jsx>{`
|
||||
.ckeditor-wrapper {
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1),
|
||||
0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
.ckeditor-wrapper :global(.ck.ck-editor__main) {
|
||||
min-height: ${props.height || 400}px;
|
||||
max-height: ${maxHeight}px;
|
||||
}
|
||||
|
||||
.ckeditor-wrapper :global(.ck.ck-editor__editable) {
|
||||
min-height: ${(props.height || 400) - 50}px;
|
||||
max-height: ${maxHeight - 50}px;
|
||||
overflow-y: auto !important;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: #cbd5e1 #f1f5f9;
|
||||
background: #fff !important;
|
||||
color: #111 !important;
|
||||
}
|
||||
|
||||
/* Dark mode support */
|
||||
:global(.dark) .ckeditor-wrapper :global(.ck.ck-editor__editable) {
|
||||
background: #111 !important;
|
||||
color: #f9fafb !important;
|
||||
}
|
||||
|
||||
:global(.dark) .ckeditor-wrapper :global(.ck.ck-editor__editable h1),
|
||||
:global(.dark) .ckeditor-wrapper :global(.ck.ck-editor__editable h2),
|
||||
:global(.dark) .ckeditor-wrapper :global(.ck.ck-editor__editable h3),
|
||||
:global(.dark) .ckeditor-wrapper :global(.ck.ck-editor__editable h4),
|
||||
:global(.dark) .ckeditor-wrapper :global(.ck.ck-editor__editable h5),
|
||||
:global(.dark) .ckeditor-wrapper :global(.ck.ck-editor__editable h6) {
|
||||
color: #f9fafb !important;
|
||||
}
|
||||
|
||||
:global(.dark)
|
||||
.ckeditor-wrapper
|
||||
:global(.ck.ck-editor__editable blockquote) {
|
||||
background-color: #1f2937 !important;
|
||||
border-left-color: #374151 !important;
|
||||
color: #f3f4f6 !important;
|
||||
}
|
||||
|
||||
/* Custom scrollbar styling for webkit browsers */
|
||||
.ckeditor-wrapper :global(.ck.ck-editor__editable::-webkit-scrollbar) {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
.ckeditor-wrapper
|
||||
:global(.ck.ck-editor__editable::-webkit-scrollbar-track) {
|
||||
background: #f1f5f9;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.ckeditor-wrapper
|
||||
:global(.ck.ck-editor__editable::-webkit-scrollbar-thumb) {
|
||||
background: #cbd5e1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.ckeditor-wrapper
|
||||
:global(.ck.ck-editor__editable::-webkit-scrollbar-thumb:hover) {
|
||||
background: #94a3b8;
|
||||
}
|
||||
|
||||
/* Dark mode scrollbar */
|
||||
:global(.dark)
|
||||
.ckeditor-wrapper
|
||||
:global(.ck.ck-editor__editable::-webkit-scrollbar-track) {
|
||||
background: #1f2937;
|
||||
}
|
||||
|
||||
:global(.dark)
|
||||
.ckeditor-wrapper
|
||||
:global(.ck.ck-editor__editable::-webkit-scrollbar-thumb) {
|
||||
background: #4b5563;
|
||||
}
|
||||
|
||||
:global(.dark)
|
||||
.ckeditor-wrapper
|
||||
:global(.ck.ck-editor__editable::-webkit-scrollbar-thumb:hover) {
|
||||
background: #6b7280;
|
||||
}
|
||||
|
||||
/* Ensure content doesn't overflow */
|
||||
.ckeditor-wrapper :global(.ck.ck-editor__editable .ck-content) {
|
||||
overflow: hidden;
|
||||
}
|
||||
`}</style>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ function ViewEditor(props) {
|
|||
.ckeditor-view-wrapper {
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1),
|
||||
box-shadow:
|
||||
0 1px 3px 0 rgba(0, 0, 0, 0.1),
|
||||
0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import {
|
|||
deleteArticleFiles,
|
||||
getArticleByCategory,
|
||||
getArticleById,
|
||||
getArticleFiles,
|
||||
submitApproval,
|
||||
unPublishArticle,
|
||||
updateArticle,
|
||||
|
|
@ -196,27 +197,49 @@ export default function EditArticleForm(props: { isDetail: boolean }) {
|
|||
|
||||
async function initState() {
|
||||
loading();
|
||||
const res = await getArticleById(id);
|
||||
const data = res.data?.data;
|
||||
setDetailData(data);
|
||||
setValue("title", data?.title);
|
||||
setValue("customCreatorName", data?.customCreatorName);
|
||||
setValue("slug", data?.slug);
|
||||
setValue("source", data?.source);
|
||||
const cleanDescription = data?.htmlDescription
|
||||
? data.htmlDescription
|
||||
.replace(/\\"/g, '"')
|
||||
.replace(/\\n/g, "\n", "\\")
|
||||
.trim()
|
||||
: "";
|
||||
setValue("description", cleanDescription);
|
||||
setValue("tags", data?.tags ? data.tags.split(",") : []);
|
||||
setThumbnail(data?.thumbnailUrl);
|
||||
setDiseId(data?.aiArticleId);
|
||||
setDetailFiles(data?.files);
|
||||
try {
|
||||
// 1️⃣ Ambil ARTICLE
|
||||
const articleRes = await getArticleById(id);
|
||||
const articleData = articleRes.data?.data;
|
||||
|
||||
setupInitCategory(data?.categories);
|
||||
close();
|
||||
if (!articleData) return;
|
||||
|
||||
// ===== ARTICLE DATA =====
|
||||
setDetailData(articleData);
|
||||
setValue("title", articleData.title);
|
||||
setValue("customCreatorName", articleData.customCreatorName);
|
||||
setValue("slug", articleData.slug);
|
||||
setValue("source", articleData.source);
|
||||
|
||||
const cleanDescription = articleData.htmlDescription
|
||||
? articleData.htmlDescription
|
||||
.replace(/\\"/g, '"')
|
||||
.replace(/\\n/g, "\n")
|
||||
.trim()
|
||||
: "";
|
||||
|
||||
setValue("description", cleanDescription);
|
||||
setValue("tags", articleData.tags ? articleData.tags.split(",") : []);
|
||||
|
||||
setThumbnail(articleData.thumbnailUrl);
|
||||
setDiseId(articleData.aiArticleId);
|
||||
setupInitCategory(articleData.categories);
|
||||
|
||||
// 2️⃣ Ambil SEMUA article files
|
||||
const filesRes = await getArticleFiles();
|
||||
const allFiles = filesRes.data?.data ?? [];
|
||||
|
||||
// 3️⃣ FILTER berdasarkan ARTICLE ID yang sedang dibuka
|
||||
const filteredFiles = allFiles.filter(
|
||||
(file: any) => file.articleId === articleData.id
|
||||
);
|
||||
|
||||
setDetailFiles(filteredFiles);
|
||||
} catch (error) {
|
||||
console.error("Init state error:", error);
|
||||
} finally {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
const setupInitCategory = (data: any) => {
|
||||
|
|
@ -667,9 +690,10 @@ export default function EditArticleForm(props: { isDetail: boolean }) {
|
|||
name="title"
|
||||
render={({ field: { onChange, value } }) => (
|
||||
<div className="w-full">
|
||||
<label htmlFor="title" className="block text-sm font-medium mb-1">
|
||||
<label htmlFor="title" className="block text-xl font-medium mb-2">
|
||||
Judul
|
||||
</label>
|
||||
|
||||
<Input
|
||||
type="text"
|
||||
id="title"
|
||||
|
|
@ -677,7 +701,7 @@ export default function EditArticleForm(props: { isDetail: boolean }) {
|
|||
value={value ?? ""}
|
||||
readOnly={isDetail}
|
||||
onChange={onChange}
|
||||
className="w-full border rounded-lg"
|
||||
className="h-16 px-4 text-2xl leading-tight"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,136 @@
|
|||
"use client";
|
||||
import { useEffect, useState } from "react";
|
||||
import Image from "next/image";
|
||||
import { getListArticle } from "@/service/article";
|
||||
import Link from "next/link";
|
||||
|
||||
type Article = {
|
||||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
categoryName: string;
|
||||
slug: string;
|
||||
createdAt: string;
|
||||
publishedAt: string;
|
||||
createdByName: string;
|
||||
customCreatorName: string;
|
||||
thumbnailUrl: string;
|
||||
categories: { title: string }[];
|
||||
files: { fileUrl: string; file_alt: string }[];
|
||||
};
|
||||
|
||||
export default function Development() {
|
||||
const [articles, setArticles] = useState<Article[]>([]);
|
||||
const [page, setPage] = useState(1);
|
||||
const [totalPage, setTotalPage] = useState(1);
|
||||
|
||||
useEffect(() => {
|
||||
initState();
|
||||
}, [page]);
|
||||
|
||||
async function initState() {
|
||||
const req = {
|
||||
limit: "10",
|
||||
page,
|
||||
search: "",
|
||||
categorySlug: "",
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// Format tanggal ke gaya lokal
|
||||
const formatDate = (dateString: string) => {
|
||||
const date = new Date(dateString);
|
||||
return date.toLocaleDateString("id-ID", {
|
||||
day: "2-digit",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
});
|
||||
};
|
||||
|
||||
// Mapping struktur seperti dummy sebelumnya
|
||||
const leftMain = articles[0];
|
||||
const leftList = articles.slice(1, 4);
|
||||
const centerMain = articles[4];
|
||||
const centerList = articles.slice(5, 8);
|
||||
const rightMain = articles[8];
|
||||
const rightList = articles.slice(9, 12);
|
||||
|
||||
return (
|
||||
<section className="max-w-7xl mx-auto px-4">
|
||||
<div className="bg-white ">
|
||||
<div className="mb-4">
|
||||
<h2 className="text-xl font-black text-[#000]">JAGA NEGERI</h2>
|
||||
|
||||
<div className="w-10 h-1 bg-green-600 mt-1 rounded"></div>
|
||||
</div>
|
||||
|
||||
<div className="border-b border-gray-300 mb-5"></div>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||
{articles.slice(0, 6).map((item) => (
|
||||
<Link
|
||||
href={`/details/${item.slug}`}
|
||||
key={item.id}
|
||||
className="flex gap-4 pb-4 border-b border-gray-200"
|
||||
>
|
||||
<div className="relative w-28 h-28 rounded-md overflow-hidden flex-shrink-0">
|
||||
<Image
|
||||
src={item.thumbnailUrl || "/placeholder.jpg"}
|
||||
alt={item.title}
|
||||
fill
|
||||
className="object-cover"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col">
|
||||
<p className="text-[11px] font-bold text-black">
|
||||
<span className="border-b-2 border-green-600 pb-[1px]">
|
||||
BERITA OPINI
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<h3 className="font-semibold text-[15px] leading-tight mt-1 line-clamp-2">
|
||||
{item.title}
|
||||
</h3>
|
||||
|
||||
<p className="text-[11px] text-gray-600 mt-2">
|
||||
By{" "}
|
||||
<span className="font-semibold">
|
||||
{item.customCreatorName}
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p className="text-[11px] text-gray-600">
|
||||
{new Date(item.publishedAt).toLocaleDateString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
})}
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
<div className="relative h-[140px] w-full overflow-hidden rounded-none my-5">
|
||||
<Image
|
||||
src="/image-kolom.png"
|
||||
alt="Berita Utama"
|
||||
fill
|
||||
className="object-fill"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,176 +1,66 @@
|
|||
// components/Footer.tsx
|
||||
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import { Facebook, Twitter, Instagram, Youtube } from "lucide-react";
|
||||
|
||||
export default function Footer() {
|
||||
return (
|
||||
<footer className=" text-[#FFFFFFCC] text-sm font-sans ">
|
||||
<div className="max-w-7xl mx-auto py-10 bg-[#09282C] px-8">
|
||||
{/* Top Menu Links */}
|
||||
<div className="flex flex-col md:flex-row justify-center md:justify-between gap-3">
|
||||
{/* <div className="w-full md:w-2/12">
|
||||
<p className="text-sm text-gray-400 mt-5">
|
||||
© 2025{" "}
|
||||
<span className="text-xs text-white font-semibold">JNews</span>-
|
||||
Premium WordPress news & magazine theme by{" "}
|
||||
<span className="text-white font-semibold">Jegtheme</span>
|
||||
</p>
|
||||
</div> */}
|
||||
<div className="flex items-center overflow-hidden mb-4 py-6 px-8">
|
||||
<Image
|
||||
src="/mikul.png"
|
||||
alt="Background"
|
||||
width={272}
|
||||
height={90}
|
||||
className="w-full md:w-[272px] h-[90px] object-cover border"
|
||||
priority
|
||||
<footer className="bg-[#ECEFF5] pt-20 pb-10 w-full">
|
||||
<div className="max-w-screen-xl mx-auto px-6 grid grid-cols-1 md:grid-cols-2 ">
|
||||
{/* Logo */}
|
||||
<div className="flex justify-center md:justify-end">
|
||||
<Image
|
||||
src="/mikul-news-logo.png"
|
||||
alt="Logo"
|
||||
width={230}
|
||||
height={230}
|
||||
className="object-contain"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Subscribe Box */}
|
||||
<div className="flex justify-center md:justify-end">
|
||||
<div className=" p-8 w-full md:w-[420px]">
|
||||
<h2 className="text-2xl font-semibold text-gray-800 leading-snug">
|
||||
Subscribe us to get <br />
|
||||
the latest news!
|
||||
</h2>
|
||||
|
||||
<label className="block mt-6 mb-1 text-sm text-gray-600">
|
||||
Email address:
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="email"
|
||||
placeholder="Your email address"
|
||||
className="w-full border border-gray-300 rounded-md px-4 py-3 outline-none"
|
||||
/>
|
||||
</div>
|
||||
<div className="w-full md:w-6/12">
|
||||
<h2 className="border-b-2 mb-5"></h2>
|
||||
<div className="flex items-start flex-wrap justify-start md:justify-start gap-2 md:gap-3 text-xs text-white font-semibold">
|
||||
{[
|
||||
{ label: "Beranda", href: "#" },
|
||||
{ label: "Pembangunan", href: "/category/development" },
|
||||
{ label: "Kesehatan", href: "/category/health" },
|
||||
{ label: "Berita Warga", href: "/category/citizen-news" },
|
||||
].map((item, idx, arr) => (
|
||||
<span
|
||||
key={idx}
|
||||
className="flex items-center gap-2 whitespace-nowrap"
|
||||
>
|
||||
<a href={item.href} className="hover:underline">
|
||||
{item.label}
|
||||
</a>
|
||||
{idx !== arr.length - 1 && (
|
||||
<span className="text-white">/</span>
|
||||
)}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className=" w-full md:w-3/12">
|
||||
<div className="flex flex-col justify-center md:justify-end gap-2 md:gap-3 text-xs text-[#FFFFFF]">
|
||||
<p className="text-xs font-bold text-red-600 mb-2 md:mb-0 w-10/12 text-start">
|
||||
Follow Us
|
||||
</p>
|
||||
<h2 className="border-b-2 "></h2>
|
||||
<div className="flex gap-6 text-white text-lg">
|
||||
<Link href="#" aria-label="Facebook">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M14 13.5h2.5l1-4H14v-2c0-1.03 0-2 2-2h1.5V2.14c-.326-.043-1.557-.14-2.857-.14C11.928 2 10 3.657 10 6.7v2.8H7v4h3V22h4z"
|
||||
/>
|
||||
</svg>
|
||||
</Link>
|
||||
<Link href="#" aria-label="Twitter">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M7.91 20.889c8.302 0 12.845-6.885 12.845-12.845c0-.193 0-.387-.009-.58A9.2 9.2 0 0 0 23 5.121a9.2 9.2 0 0 1-2.597.713a4.54 4.54 0 0 0 1.99-2.5a9 9 0 0 1-2.87 1.091A4.5 4.5 0 0 0 16.23 3a4.52 4.52 0 0 0-4.516 4.516c0 .352.044.696.114 1.03a12.82 12.82 0 0 1-9.305-4.718a4.526 4.526 0 0 0 1.4 6.03a4.6 4.6 0 0 1-2.043-.563v.061a4.524 4.524 0 0 0 3.62 4.428a4.4 4.4 0 0 1-1.189.159q-.435 0-.845-.08a4.51 4.51 0 0 0 4.217 3.135a9.05 9.05 0 0 1-5.608 1.936A9 9 0 0 1 1 18.873a12.84 12.84 0 0 0 6.91 2.016"
|
||||
/>
|
||||
</svg>
|
||||
</Link>
|
||||
<Link href="#" aria-label="Google" className="text-[#F5F5F5]">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
// fill-rule="evenodd"
|
||||
d="M7.796 14.333v-2.618h7.211c.066.382.12.763.12 1.265c0 4.364-2.923 7.462-7.33 7.462A7.63 7.63 0 0 1 .16 12.806a7.63 7.63 0 0 1 7.636-7.637c2.062 0 3.786.753 5.117 1.997L10.84 9.162c-.567-.546-1.56-1.178-3.044-1.178c-2.607 0-4.734 2.16-4.734 4.822s2.127 4.821 4.734 4.821c3.022 0 4.157-2.17 4.331-3.294zm13.27-2.6H23.2v2.134h-2.133V16h-2.134v-2.133H16.8v-2.134h2.133V9.6h2.134z"
|
||||
// clip-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</Link>
|
||||
<Link href="#" aria-label="Pinterest">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<defs>
|
||||
<path
|
||||
id="akarIconsPinterestFill0"
|
||||
fill="#fff"
|
||||
d="M0 0h24v24H0z"
|
||||
/>
|
||||
</defs>
|
||||
<g fill="none">
|
||||
<g
|
||||
// clip-path="url(#akarIconsPinterestFill1)"
|
||||
>
|
||||
<g
|
||||
// clip-path="url(#akarIconsPinterestFill2)"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M0 12c0 5.123 3.211 9.497 7.73 11.218c-.11-.937-.227-2.482.025-3.566c.217-.932 1.401-5.938 1.401-5.938s-.357-.715-.357-1.774c0-1.66.962-2.9 2.161-2.9c1.02 0 1.512.765 1.512 1.682c0 1.025-.653 2.557-.99 3.978c-.281 1.189.597 2.159 1.769 2.159c2.123 0 3.756-2.239 3.756-5.471c0-2.861-2.056-4.86-4.991-4.86c-3.398 0-5.393 2.549-5.393 5.184c0 1.027.395 2.127.889 2.726a.36.36 0 0 1 .083.343c-.091.378-.293 1.189-.332 1.355c-.053.218-.173.265-.4.159c-1.492-.694-2.424-2.875-2.424-4.627c0-3.769 2.737-7.229 7.892-7.229c4.144 0 7.365 2.953 7.365 6.899c0 4.117-2.595 7.431-6.199 7.431c-1.211 0-2.348-.63-2.738-1.373c0 0-.599 2.282-.744 2.84c-.282 1.084-1.064 2.456-1.549 3.235C9.584 23.815 10.77 24 12 24c6.627 0 12-5.373 12-12S18.627 0 12 0S0 5.373 0 12"
|
||||
/>
|
||||
</g>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="akarIconsPinterestFill1">
|
||||
<use href="#akarIconsPinterestFill0" />
|
||||
</clipPath>
|
||||
<clipPath id="akarIconsPinterestFill2">
|
||||
<use href="#akarIconsPinterestFill0" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
</g>
|
||||
</svg>
|
||||
</Link>
|
||||
|
||||
<Link href="#" aria-label="Vk">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
// fill-rule="evenodd"
|
||||
d="M23.45 5.948c.166-.546 0-.948-.795-.948H20.03c-.668 0-.976.347-1.143.73c0 0-1.335 3.196-3.226 5.272c-.612.602-.89.793-1.224.793c-.167 0-.418-.191-.418-.738V5.948c0-.656-.184-.948-.74-.948H9.151c-.417 0-.668.304-.668.593c0 .621.946.765 1.043 2.513v3.798c0 .833-.153.984-.487.984c-.89 0-3.055-3.211-4.34-6.885C4.45 5.288 4.198 5 3.527 5H.9c-.75 0-.9.347-.9.73c0 .682.89 4.07 4.145 8.551C6.315 17.341 9.37 19 12.153 19c1.669 0 1.875-.368 1.875-1.003v-2.313c0-.737.158-.884.687-.884c.39 0 1.057.192 2.615 1.667C19.11 18.216 19.403 19 20.405 19h2.625c.75 0 1.126-.368.91-1.096c-.238-.724-1.088-1.775-2.215-3.022c-.612-.71-1.53-1.475-1.809-1.858c-.389-.491-.278-.71 0-1.147c0 0 3.2-4.426 3.533-5.929"
|
||||
// clip-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</Link>
|
||||
<Link href="#" aria-label="Wifi">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M12 21q-1.05 0-1.775-.725T9.5 18.5t.725-1.775T12 16t1.775.725t.725 1.775t-.725 1.775T12 21m-5.65-5.65l-2.1-2.15q1.475-1.475 3.463-2.337T12 10t4.288.875t3.462 2.375l-2.1 2.1q-1.1-1.1-2.55-1.725T12 13t-3.1.625t-2.55 1.725M2.1 11.1L0 9q2.3-2.35 5.375-3.675T12 4t6.625 1.325T24 9l-2.1 2.1q-1.925-1.925-4.462-3.012T12 7T6.563 8.088T2.1 11.1"
|
||||
/>
|
||||
</svg>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
<button className="mt-4 bg-green-600 hover:bg-green-500 text-black px-6 py-3 rounded-md font-medium">
|
||||
SIGN UP
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap justify-center gap-8 mt-16 text-gray-600 text-sm">
|
||||
<a href="#">About Us</a>
|
||||
<a href="#">Contact</a>
|
||||
<a href="#">Kode Etik Jurnalistik</a>
|
||||
<a href="#">Kebijakan Privasi</a>
|
||||
<a href="#">Disclaimer</a>
|
||||
<a href="#">Pedoman Media Siber</a>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-center gap-8 mt-8 text-gray-700">
|
||||
<Facebook className="w-5 h-5 cursor-pointer" />
|
||||
<Twitter className="w-5 h-5 cursor-pointer" />
|
||||
<Instagram className="w-5 h-5 cursor-pointer" />
|
||||
<Youtube className="w-5 h-5 cursor-pointer" />
|
||||
</div>
|
||||
|
||||
<p className="text-start text-gray-500 text-sm mt-8 pl-5">
|
||||
© 2025 Mikul News - All Rights Reserved.
|
||||
</p>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
"use client";
|
||||
|
||||
import { getListArticle } from "@/service/article";
|
||||
import { useEffect, useState } from "react";
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import { getAdvertise } from "@/service/advertisement";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
type Article = {
|
||||
id: number;
|
||||
|
|
@ -12,220 +11,221 @@ type Article = {
|
|||
description: string;
|
||||
categoryName: string;
|
||||
createdAt: string;
|
||||
createdByName: string;
|
||||
slug: string;
|
||||
createdByName: string;
|
||||
publishedAt: string;
|
||||
customCreatorName: string;
|
||||
thumbnailUrl: string;
|
||||
categories: {
|
||||
title: string;
|
||||
}[];
|
||||
files: {
|
||||
fileUrl: string;
|
||||
file_alt: string;
|
||||
}[];
|
||||
categories: { title: string }[];
|
||||
files: { fileUrl: string; file_alt: string }[];
|
||||
};
|
||||
|
||||
type Advertise = {
|
||||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
placement: string;
|
||||
contentFileUrl: string;
|
||||
redirectLink: string;
|
||||
};
|
||||
|
||||
export default function HeroNewsSection() {
|
||||
const [page, setPage] = useState(1);
|
||||
const [totalPage, setTotalPage] = useState(1);
|
||||
export default function Header() {
|
||||
const [articles, setArticles] = useState<Article[]>([]);
|
||||
const [showData, setShowData] = useState("5");
|
||||
const [search, setSearch] = useState("");
|
||||
const [selectedCategories, setSelectedCategories] = useState<any>("");
|
||||
const [startDateValue, setStartDateValue] = useState({
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
});
|
||||
|
||||
const [bannerAd, setBannerAd] = useState<Advertise | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
initStateAdver();
|
||||
}, []);
|
||||
const fetchArticles = async () => {
|
||||
const req = {
|
||||
limit: "10",
|
||||
page: 1,
|
||||
search: "",
|
||||
categorySlug: "",
|
||||
sort: "desc",
|
||||
isPublish: true,
|
||||
sortBy: "created_at",
|
||||
};
|
||||
|
||||
async function initStateAdver() {
|
||||
const req = {
|
||||
limit: 100,
|
||||
page: 1,
|
||||
sort: "desc",
|
||||
sortBy: "created_at",
|
||||
isPublish: true,
|
||||
};
|
||||
|
||||
try {
|
||||
const res = await getAdvertise(req);
|
||||
const data: Advertise[] = res?.data?.data || [];
|
||||
|
||||
// filter iklan dengan placement = "banner"
|
||||
const banner = data.find((ad) => ad.placement === "banner");
|
||||
|
||||
if (banner) {
|
||||
setBannerAd(banner);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Error fetching advertisement:", err);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
initState();
|
||||
}, [page, showData, startDateValue, selectedCategories]);
|
||||
|
||||
async function initState() {
|
||||
// loading();
|
||||
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);
|
||||
} finally {
|
||||
// close();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
fetchArticles();
|
||||
}, []);
|
||||
|
||||
const flashArticles = articles.slice(0, 8);
|
||||
const mainArticle = articles[8] || articles[0];
|
||||
const recentPosts = articles.slice(1, 5);
|
||||
|
||||
return (
|
||||
<section className="max-w-7xl mx-auto bg-white">
|
||||
<div className="flex items-center bg-[#F2F4F3] w-full overflow-hidden mb-4 py-6 px-8">
|
||||
<Image
|
||||
src="/mikul.png"
|
||||
alt="Background"
|
||||
width={272}
|
||||
height={90}
|
||||
className="w-full md:w-[272px] h-[90px] object-cover border"
|
||||
priority
|
||||
/>
|
||||
<section className="max-w-7xl mx-auto bg-white px-4">
|
||||
{/* FLASH STRIP */}
|
||||
<div className="flex items-center justify-between mt-6 mb-3">
|
||||
<div className="flex items-center gap-3">
|
||||
<h4 className="text-green-600 font-semibold">Flash</h4>
|
||||
<span className="text-red-500">⚡</span>
|
||||
</div>
|
||||
<div className="text-xs text-gray-500 hidden md:block">LOAD MORE ➜</div>
|
||||
</div>
|
||||
|
||||
<div className="pb-5">
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-5 gap-2 m-8 ">
|
||||
{articles.length > 0 && (
|
||||
<div className="md:col-span-2 lg:col-span-3 relative">
|
||||
<Link href={`/details/${articles[0]?.slug}`}>
|
||||
<div className="overflow-x-auto no-scrollbar py-2">
|
||||
<div className="flex gap-4">
|
||||
{flashArticles.map((item) => (
|
||||
<Link
|
||||
href={`/details/${item.slug}`}
|
||||
key={`flash-${item.id}`}
|
||||
className="min-w-[200px] md:min-w-[220px] bg-gray-800 rounded-lg overflow-hidden relative shadow"
|
||||
>
|
||||
<div className="relative w-[200px] md:w-[220px] h-[140px]">
|
||||
<Image
|
||||
src={
|
||||
articles[0]?.files?.[0]?.fileUrl ||
|
||||
articles[0]?.files?.[0]?.fileUrl ||
|
||||
"/default-image.jpg"
|
||||
item.thumbnailUrl ||
|
||||
item.files?.[0]?.fileUrl ||
|
||||
"/placeholder.jpg"
|
||||
}
|
||||
alt={articles[0].title}
|
||||
width={800}
|
||||
height={500}
|
||||
className="w-full h-full max-h-[460px] object-cover"
|
||||
alt={item.title}
|
||||
fill
|
||||
className="object-cover"
|
||||
/>
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-black/70 via-black/50 to-transparent p-6 flex flex-col justify-end">
|
||||
<span className="text-xs bg-yellow-400 text-black px-2 py-0.5 inline-block mb-2 uppercase w-[130px]">
|
||||
{articles[0].categories?.[0]?.title || "TANPA KATEGORI"}
|
||||
</div>
|
||||
|
||||
{/* dark overlay with text */}
|
||||
<div className="absolute bottom-0 left-0 right-0 p-3 bg-gradient-to-t from-black/80 to-transparent text-white">
|
||||
<p className="text-xs line-clamp-2">{item.title}</p>
|
||||
<div className="flex items-center justify-between mt-2 text-[11px] text-gray-300">
|
||||
<span className="text-yellow-300 bg-black/30 px-1 rounded-sm">
|
||||
{item.categoryName ||
|
||||
item.categories?.[0]?.title ||
|
||||
"Berita"}
|
||||
</span>
|
||||
<h2 className="text-sm md:text-xl lg:text-2xl font-bold text-white leading-snug mb-2 w-full md:w-9/12">
|
||||
{articles[0].title}
|
||||
</h2>
|
||||
<p className="text-white text-xs flex items-center gap-2">
|
||||
{articles[0]?.customCreatorName ||
|
||||
articles[0]?.createdByName}{" "}
|
||||
-{" "}
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<g fill="none">
|
||||
<path d="m12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z" />
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2m0 2a8 8 0 1 0 0 16a8 8 0 0 0 0-16m0 2a1 1 0 0 1 .993.883L13 7v4.586l2.707 2.707a1 1 0 0 1-1.32 1.497l-.094-.083l-3-3a1 1 0 0 1-.284-.576L11 12V7a1 1 0 0 1 1-1"
|
||||
/>
|
||||
</g>
|
||||
</svg>{" "}
|
||||
{new Date(articles[0].createdAt).toLocaleDateString(
|
||||
<span>●</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* play icon */}
|
||||
<div className="absolute top-3 right-3 w-8 h-8 bg-white/80 rounded-full flex items-center justify-center">
|
||||
<svg
|
||||
className="w-4 h-4 text-black"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
>
|
||||
<path d="M8 5v14l11-7z" />
|
||||
</svg>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Main Layout */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-[2.2fr_1fr] gap-6">
|
||||
{/* LEFT SIDE – MAIN ARTICLE */}
|
||||
{mainArticle ? (
|
||||
<div className="relative h-[500px] w-full rounded-xl overflow-hidden shadow-md">
|
||||
<Link href={`/details/${mainArticle.slug}`}>
|
||||
<Image
|
||||
src={
|
||||
mainArticle.thumbnailUrl ||
|
||||
mainArticle.files?.[0]?.fileUrl ||
|
||||
"/placeholder.jpg"
|
||||
}
|
||||
alt={mainArticle.files?.[0]?.file_alt || mainArticle.title}
|
||||
fill
|
||||
className="object-cover"
|
||||
/>
|
||||
|
||||
{/* White Card Overlay */}
|
||||
<div className="absolute bottom-6 left-6 bg-white bg-opacity-95 backdrop-blur-sm p-6 shadow-lg max-w-lg">
|
||||
<span className="text-[11px] bg-green-700 text-white px-2 py-1 rounded-sm">
|
||||
{mainArticle.categoryName ||
|
||||
mainArticle.categories?.[0]?.title ||
|
||||
"Berita"}
|
||||
</span>
|
||||
|
||||
<h2 className="text-xl md:text-2xl font-bold text-gray-900 mt-2 leading-snug">
|
||||
{mainArticle.title}
|
||||
</h2>
|
||||
|
||||
<div className="flex items-center gap-2 text-gray-600 text-xs mt-3">
|
||||
<span>
|
||||
By{" "}
|
||||
{mainArticle.customCreatorName ||
|
||||
mainArticle.createdByName ||
|
||||
"Admin"}
|
||||
</span>
|
||||
<span>•</span>
|
||||
<span>
|
||||
{new Date(mainArticle.publishedAt).toLocaleDateString(
|
||||
"id-ID",
|
||||
{
|
||||
day: "numeric",
|
||||
day: "2-digit",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
}
|
||||
},
|
||||
)}
|
||||
</p>
|
||||
</span>
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-gray-500">Loading...</p>
|
||||
)}
|
||||
|
||||
<div className="md:col-span-1 lg:col-span-2 grid grid-cols-1 sm:grid-cols-2 gap-2">
|
||||
{articles.slice(1, 5).map((article, index) => (
|
||||
<div key={index} className="relative">
|
||||
<Link href={`/details/${article?.slug}`}>
|
||||
{/* RIGHT SIDE – RECENT POSTS */}
|
||||
<div>
|
||||
<h3 className="text-lg font-semibold mb-3">Recent Posts</h3>
|
||||
|
||||
<div className="space-y-4">
|
||||
{recentPosts.map((item) => (
|
||||
<Link
|
||||
key={item.id}
|
||||
href={`/details/${item.slug}`}
|
||||
className="flex gap-3"
|
||||
>
|
||||
<div className="relative w-35 h-25 rounded-md overflow-hidden">
|
||||
<Image
|
||||
src={
|
||||
article.thumbnailUrl ||
|
||||
article?.files?.[0]?.fileUrl ||
|
||||
"/default-image.jpg"
|
||||
item.thumbnailUrl ||
|
||||
item.files?.[0]?.fileUrl ||
|
||||
"/placeholder.jpg"
|
||||
}
|
||||
alt={article.title}
|
||||
width={400}
|
||||
height={240}
|
||||
className="w-full h-56 object-cover"
|
||||
alt={item.title}
|
||||
fill
|
||||
className="object-cover"
|
||||
/>
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-black/70 via-black/40 to-transparent p-4 flex flex-col justify-end">
|
||||
<span className="text-xs bg-yellow-400 text-black px-2 py-0.5 inline-block uppercase w-[130px]">
|
||||
{article?.categories?.[0]?.title || "TANPA KATEGORI"}
|
||||
</span>
|
||||
<h3 className="text-sm font-semibold text-white leading-snug mb-1">
|
||||
{article.title}
|
||||
</h3>
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col">
|
||||
<p className="text-sm font-semibold line-clamp-2">
|
||||
{item.title}
|
||||
</p>
|
||||
<span className="text-xs text-gray-500 mt-1">
|
||||
{new Date(item.publishedAt).toLocaleDateString("id-ID", {
|
||||
day: "2-digit",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
})}
|
||||
</span>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="relative mt-10 mb-2 flex justify-center mx-8 border my-8 h-[350px] overflow-hidden bg-white">
|
||||
{bannerAd ? (
|
||||
<a
|
||||
href={bannerAd.redirectLink}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="block w-full"
|
||||
>
|
||||
<div className="relative w-full h-[350px] flex justify-center">
|
||||
<Image
|
||||
src={bannerAd.contentFileUrl}
|
||||
alt={bannerAd.title || "Iklan Banner"}
|
||||
width={1200} // ukuran dasar untuk responsive
|
||||
height={350}
|
||||
className="object-cover w-full h-full"
|
||||
/>
|
||||
</div>
|
||||
</a>
|
||||
) : (
|
||||
<Image
|
||||
src="/image-kolom.png"
|
||||
alt="Berita Utama"
|
||||
width={1200}
|
||||
height={188}
|
||||
className="object-contain w-full h-[188px]"
|
||||
{/* LOAD MORE */}
|
||||
<div className="flex justify-center my-6">
|
||||
<button className="text-gray-600 text-sm flex items-center gap-2 border-b pb-1">
|
||||
<span>LOAD MORE</span>
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none">
|
||||
<path
|
||||
d="M12 5v14M5 12h14"
|
||||
stroke="#9CA3AF"
|
||||
strokeWidth="1.5"
|
||||
strokeLinecap="round"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* KOLOM PPS BOTTOM BANNER */}
|
||||
<div className="relative h-[140px] w-full overflow-hidden rounded-none my-5 border rounded-md">
|
||||
<Image
|
||||
src="/image-kolom.png"
|
||||
alt="Kolom PPS Bottom Banner"
|
||||
fill
|
||||
className="object-contain"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,186 @@
|
|||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import { getListArticle } from "@/service/article";
|
||||
|
||||
type Article = {
|
||||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
categoryName: string;
|
||||
createdAt: string;
|
||||
publishedAt: string;
|
||||
slug: string;
|
||||
createdByName: string;
|
||||
customCreatorName?: string;
|
||||
thumbnailUrl?: string;
|
||||
categories?: { title: string }[];
|
||||
};
|
||||
|
||||
export default function NewsTerkini() {
|
||||
const [articles, setArticles] = useState<Article[]>([]);
|
||||
const [popular, setPopular] = useState<Article[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
async function loadData() {
|
||||
setLoading(true);
|
||||
|
||||
try {
|
||||
const res = await getListArticle({
|
||||
limit: "20",
|
||||
page: 1,
|
||||
search: "",
|
||||
isPublish: true,
|
||||
sort: "desc",
|
||||
sortBy: "created_at",
|
||||
});
|
||||
|
||||
const data = res?.data?.data || [];
|
||||
setArticles(data.slice(0, 5));
|
||||
setPopular(data.slice(0, 5));
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
const formatDate = (d: string) =>
|
||||
new Date(d).toLocaleDateString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
});
|
||||
|
||||
if (loading)
|
||||
return (
|
||||
<p className="text-center py-10 text-gray-500">
|
||||
Memuat berita terbaru...
|
||||
</p>
|
||||
);
|
||||
|
||||
return (
|
||||
<section className="max-w-7xl mx-auto px-4 grid grid-cols-1 lg:grid-cols-[2fr_1fr] gap-6">
|
||||
<div>
|
||||
<h2 className="text-lg font-bold text-gray-900">BERITA TERKINI</h2>
|
||||
<div className="w-14 h-1 bg-green-600 mt-1 mb-4"></div>
|
||||
|
||||
<div className="space-y-6">
|
||||
{articles.map((item) => (
|
||||
<Link
|
||||
key={item.id}
|
||||
href={`/details/${item.slug}`}
|
||||
className="block border-b pb-6"
|
||||
>
|
||||
<div className="flex gap-4">
|
||||
<div className="flex-1">
|
||||
{/* CATEGORY */}
|
||||
<p className="text-[11px] text-green-700 font-semibold mb-1">
|
||||
{item.categoryName || "Kategori"}
|
||||
</p>
|
||||
|
||||
{/* JUDUL */}
|
||||
<h3 className="font-bold text-base leading-snug line-clamp-2">
|
||||
{item.title}
|
||||
</h3>
|
||||
|
||||
{/* DESKRIPSI */}
|
||||
<p className="text-sm text-gray-600 line-clamp-2 mt-1">
|
||||
{item.description}
|
||||
</p>
|
||||
|
||||
{/* AUTHOR + DATE */}
|
||||
<p className="text-xs text-gray-400 mt-2">
|
||||
By {item.customCreatorName || item.createdByName} —{" "}
|
||||
{formatDate(item.publishedAt)}
|
||||
</p>
|
||||
</div>
|
||||
<div className="relative w-40 h-28 rounded overflow-hidden flex-shrink-0">
|
||||
<Image
|
||||
src={item.thumbnailUrl || "/placeholder.jpg"}
|
||||
alt={item.title}
|
||||
fill
|
||||
className="object-cover"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* LOAD MORE */}
|
||||
<div className="text-center mt-4 text-green-600 text-sm cursor-pointer">
|
||||
LOAD MORE ↓
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="lg:col-span-1">
|
||||
<h2 className="text-lg font-bold text-gray-900">TERBANYAK DIBAGIKAN</h2>
|
||||
<div className="w-14 h-1 bg-green-600 mt-1 mb-4"></div>
|
||||
|
||||
<div className="space-y-4">
|
||||
{popular.map((item, index) => (
|
||||
<Link
|
||||
key={item.id}
|
||||
href={`/details/${item.slug}`}
|
||||
className="flex gap-3 border-b pb-4"
|
||||
>
|
||||
{/* NOMOR */}
|
||||
<div className="text-green-600 font-extrabold text-3xl leading-none">
|
||||
{(index + 1).toString().padStart(2, "0")}
|
||||
</div>
|
||||
|
||||
<div className="flex-1">
|
||||
<p className="text-[10px] text-gray-500">
|
||||
{item.categories?.[0]?.title || "Kategori"}
|
||||
</p>
|
||||
<h4 className="font-semibold text-sm leading-snug line-clamp-2">
|
||||
{item.title}
|
||||
</h4>
|
||||
<p className="text-[10px] text-gray-400 mt-1">
|
||||
{formatDate(item.createdAt)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* THUMBNAIL KECIL */}
|
||||
<div className="relative w-16 h-14 rounded overflow-hidden">
|
||||
<Image
|
||||
src={item.thumbnailUrl || "/placeholder.jpg"}
|
||||
alt={item.title}
|
||||
fill
|
||||
className="object-cover"
|
||||
/>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="mt-6">
|
||||
<div className="relative h-[180px] border rounded-lg overflow-hidden mb-6">
|
||||
<Image
|
||||
src="/image-kolom.png"
|
||||
alt="Kolom PPS"
|
||||
fill
|
||||
className="object-contain bg-white"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="relative h-[180px] border rounded-lg overflow-hidden">
|
||||
<Image
|
||||
src="/image-kolom.png"
|
||||
alt="Kolom PPS"
|
||||
fill
|
||||
className="object-contain bg-white"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
|
@ -171,6 +171,7 @@ type Article = {
|
|||
title: string;
|
||||
description: string;
|
||||
categoryName: string;
|
||||
publishedAt: string;
|
||||
createdAt: string;
|
||||
createdByName: string;
|
||||
slug: string;
|
||||
|
|
@ -239,7 +240,7 @@ export default function LatestandPopular() {
|
|||
const startIndex = (currentPage - 1) * ITEMS_PER_PAGE;
|
||||
const currentArticles = articles.slice(
|
||||
startIndex,
|
||||
startIndex + ITEMS_PER_PAGE
|
||||
startIndex + ITEMS_PER_PAGE,
|
||||
);
|
||||
return (
|
||||
<section className="bg-white py-10 px-4 md:px-10 w-full">
|
||||
|
|
@ -301,14 +302,18 @@ export default function LatestandPopular() {
|
|||
/>
|
||||
</g>
|
||||
</svg>{" "}
|
||||
{new Date(article?.createdAt).toLocaleDateString(
|
||||
"id-ID",
|
||||
{
|
||||
{new Date(article?.publishedAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
}
|
||||
)}
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
className="h-4 w-4"
|
||||
|
|
@ -401,14 +406,18 @@ export default function LatestandPopular() {
|
|||
/>
|
||||
</g>
|
||||
</svg>{" "}
|
||||
{new Date(articles[0]?.createdAt).toLocaleDateString(
|
||||
"id-ID",
|
||||
{
|
||||
{new Date(articles[0]?.publishedAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
}
|
||||
)}
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
|
@ -452,14 +461,18 @@ export default function LatestandPopular() {
|
|||
/>
|
||||
</g>
|
||||
</svg>{" "}
|
||||
{new Date(articles[0]?.createdAt).toLocaleDateString(
|
||||
"id-ID",
|
||||
{
|
||||
{new Date(articles[0]?.publishedAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
}
|
||||
)}
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,126 @@
|
|||
"use client";
|
||||
|
||||
import { getListArticle } from "@/service/article";
|
||||
import { ChevronDown } from "lucide-react";
|
||||
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;
|
||||
slug: string;
|
||||
createdAt: string;
|
||||
publishedAt: string;
|
||||
createdByName: string;
|
||||
customCreatorName: string;
|
||||
thumbnailUrl: string;
|
||||
categories: { title: string }[];
|
||||
files: { fileUrl: string; file_alt: string }[];
|
||||
};
|
||||
|
||||
export default function News() {
|
||||
const [page, setPage] = useState(1);
|
||||
const [totalPage, setTotalPage] = useState(1);
|
||||
const [articles, setArticles] = useState<Article[]>([]);
|
||||
const [showData, setShowData] = useState("6");
|
||||
const [search] = useState("");
|
||||
const [selectedCategories] = useState<any>("");
|
||||
const [startDateValue] = 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 (
|
||||
<section className="max-w-screen-xl mx-auto px-4 py-10">
|
||||
<div className="">
|
||||
{/* TITLE */}
|
||||
<div className="mb-4">
|
||||
<h2 className="text-xl font-black text-[#000]">BERITA POPULER</h2>
|
||||
<div className="w-10 h-1 bg-green-600 mt-1 rounded"></div>
|
||||
</div>
|
||||
|
||||
{/* GRID 4 KOLOM */}
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-6">
|
||||
{articles.slice(0, 4).map((item) => (
|
||||
<Link href={`/details/${item.slug}`} key={item.id}>
|
||||
<div>
|
||||
{/* GAMBAR */}
|
||||
<div className="relative w-full h-56 rounded-lg overflow-hidden">
|
||||
<Image
|
||||
src={item.thumbnailUrl || "/placeholder.jpg"}
|
||||
alt={item.title}
|
||||
fill
|
||||
className="object-cover"
|
||||
/>
|
||||
|
||||
{/* BADGE CATEGORY DI DALAM GAMBAR */}
|
||||
<div className="absolute bottom-2 left-2">
|
||||
<span className="px-3 py-1 text-[10px] font-semibold bg-green-600 text-white rounded">
|
||||
{item.categoryName || "Kategori"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* JUDUL */}
|
||||
<h3 className="mt-2 text-base font-bold leading-snug line-clamp-2">
|
||||
{item.title}
|
||||
</h3>
|
||||
|
||||
{/* AUTHOR + DATE */}
|
||||
<div className="text-[11px] mt-2 flex items-center gap-1 text-gray-700">
|
||||
<span className="font-semibold">
|
||||
By {item.customCreatorName || item.createdByName || "Admin"}
|
||||
</span>
|
||||
<span className="text-yellow-500">-</span>
|
||||
<span>
|
||||
{new Date(item.publishedAt).toLocaleDateString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
})}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="relative h-[160px] w-full overflow-hidden rounded-xl mt-6">
|
||||
<Image
|
||||
src="/image-kolom.png"
|
||||
alt="Kolom PPS"
|
||||
fill
|
||||
className="object-contain bg-white"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
|
@ -176,6 +176,7 @@ type Article = {
|
|||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
publishedAt: string;
|
||||
categoryName: string;
|
||||
createdAt: string;
|
||||
slug: string;
|
||||
|
|
@ -278,14 +279,18 @@ export default function Latest({ id }: { id: number }) {
|
|||
/>
|
||||
</g>
|
||||
</svg>{" "}
|
||||
{new Date(articles[0]?.createdAt).toLocaleDateString(
|
||||
"id-ID",
|
||||
{
|
||||
{new Date(articles[0]?.publishedAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
}
|
||||
)}
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
|
@ -325,14 +330,18 @@ export default function Latest({ id }: { id: number }) {
|
|||
/>
|
||||
</g>
|
||||
</svg>{" "}
|
||||
{new Date(articles[0]?.createdAt).toLocaleDateString(
|
||||
"id-ID",
|
||||
{
|
||||
{new Date(articles[0]?.publishedAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
}
|
||||
)}
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
|
@ -373,14 +382,18 @@ export default function Latest({ id }: { id: number }) {
|
|||
/>
|
||||
</g>
|
||||
</svg>{" "}
|
||||
{new Date(articles[0]?.createdAt).toLocaleDateString(
|
||||
"id-ID",
|
||||
{
|
||||
{new Date(articles[0]?.publishedAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
}
|
||||
)}
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
|
@ -420,14 +433,18 @@ export default function Latest({ id }: { id: number }) {
|
|||
/>
|
||||
</g>
|
||||
</svg>{" "}
|
||||
{new Date(articles[0]?.createdAt).toLocaleDateString(
|
||||
"id-ID",
|
||||
{
|
||||
{new Date(articles[0]?.publishedAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
}
|
||||
)}
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
|
@ -502,14 +519,18 @@ export default function Latest({ id }: { id: number }) {
|
|||
/>
|
||||
</g>
|
||||
</svg>{" "}
|
||||
{new Date(articles[0]?.createdAt).toLocaleDateString(
|
||||
"id-ID",
|
||||
{
|
||||
{new Date(articles[0]?.publishedAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
}
|
||||
)}
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
className="h-4 w-4"
|
||||
|
|
|
|||
|
|
@ -1,229 +1,170 @@
|
|||
"use client";
|
||||
import { useState } from "react";
|
||||
|
||||
import { Search } from "lucide-react";
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import { Menu, Lock, Search } from "lucide-react";
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
const Navbar = () => {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const toggleMenu = () => setIsOpen(!isOpen);
|
||||
|
||||
export default function Navbar() {
|
||||
const pathname = usePathname();
|
||||
|
||||
const navLinks = [
|
||||
{ href: "/", label: "BERANDA" },
|
||||
{ href: "/category/development", label: "PEMBANGUNAN" },
|
||||
{ href: "/category/health", label: "KESEHATAN" },
|
||||
{ href: "/category/citizen-news", label: "BERITA WARGA" },
|
||||
];
|
||||
|
||||
const isActive = (href: string) => {
|
||||
if (href === "/") {
|
||||
return pathname === "/";
|
||||
}
|
||||
return pathname.startsWith(href);
|
||||
const isActive = (href: any) => {
|
||||
return pathname === href || pathname.startsWith(href + "/");
|
||||
};
|
||||
|
||||
return (
|
||||
<nav className="w-full bg-white shadow-md">
|
||||
<div className="max-w-7xl mx-auto py-2 px-0 md:px-4 flex flex-col md:flex-row justify-end items-start md:justify-between md:items-center gap-4 bg-[#308A2E]">
|
||||
<div className="flex items-center gap-4 w-full md:w-auto mx-3 md:mx-5">
|
||||
<div className="flex gap-3 text-xs mx-3 text-white">
|
||||
<Link href="/about" className="hover:text-yellow-400 ">
|
||||
About
|
||||
</Link>
|
||||
<Link href="/advertise" className="hover:text-yellow-400">
|
||||
Advertise
|
||||
</Link>
|
||||
<Link href="/privacy" className="hover:text-yellow-400">
|
||||
Privacy & Policy
|
||||
</Link>
|
||||
<Link href="/contact" className="hover:text-yellow-400">
|
||||
Contact
|
||||
</Link>
|
||||
<div className="w-full bg-white py-4 border-b">
|
||||
<div className="max-w-screen-xl mx-auto flex flex-col justify-between px-4">
|
||||
{/* Left: Logo */}
|
||||
<div className="flex flex-row justify-between mb-3">
|
||||
<div className="flex items-center">
|
||||
<Image
|
||||
src="/mikul-news-logo.png"
|
||||
alt="Kritik Tajam Logo"
|
||||
width={140}
|
||||
height={100}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-5 text-sm whitespace-nowrap text-white mx-5">
|
||||
<div className="hidden md:block min-w-fit whitespace-nowrap text-white text-xs">
|
||||
{new Date().toLocaleDateString("id-ID", {
|
||||
weekday: "long",
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
})}
|
||||
</div>
|
||||
<div className="flex gap-3 text-white text-lg">
|
||||
<Link href="#" aria-label="Facebook">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="15"
|
||||
height="15"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M14 13.5h2.5l1-4H14v-2c0-1.03 0-2 2-2h1.5V2.14c-.326-.043-1.557-.14-2.857-.14C11.928 2 10 3.657 10 6.7v2.8H7v4h3V22h4z"
|
||||
/>
|
||||
</svg>
|
||||
</Link>
|
||||
<Link href="#" aria-label="Twitter">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="15"
|
||||
height="15"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M7.91 20.889c8.302 0 12.845-6.885 12.845-12.845c0-.193 0-.387-.009-.58A9.2 9.2 0 0 0 23 5.121a9.2 9.2 0 0 1-2.597.713a4.54 4.54 0 0 0 1.99-2.5a9 9 0 0 1-2.87 1.091A4.5 4.5 0 0 0 16.23 3a4.52 4.52 0 0 0-4.516 4.516c0 .352.044.696.114 1.03a12.82 12.82 0 0 1-9.305-4.718a4.526 4.526 0 0 0 1.4 6.03a4.6 4.6 0 0 1-2.043-.563v.061a4.524 4.524 0 0 0 3.62 4.428a4.4 4.4 0 0 1-1.189.159q-.435 0-.845-.08a4.51 4.51 0 0 0 4.217 3.135a9.05 9.05 0 0 1-5.608 1.936A9 9 0 0 1 1 18.873a12.84 12.84 0 0 0 6.91 2.016"
|
||||
/>
|
||||
</svg>
|
||||
</Link>
|
||||
<Link href="#" aria-label="Google" className="text-[#F5F5F5]">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="15"
|
||||
height="15"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
// fill-rule="evenodd"
|
||||
d="M7.796 14.333v-2.618h7.211c.066.382.12.763.12 1.265c0 4.364-2.923 7.462-7.33 7.462A7.63 7.63 0 0 1 .16 12.806a7.63 7.63 0 0 1 7.636-7.637c2.062 0 3.786.753 5.117 1.997L10.84 9.162c-.567-.546-1.56-1.178-3.044-1.178c-2.607 0-4.734 2.16-4.734 4.822s2.127 4.821 4.734 4.821c3.022 0 4.157-2.17 4.331-3.294zm13.27-2.6H23.2v2.134h-2.133V16h-2.134v-2.133H16.8v-2.134h2.133V9.6h2.134z"
|
||||
// clip-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</Link>
|
||||
<Link href="#" aria-label="Pinterest">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="15"
|
||||
height="15"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<defs>
|
||||
<div className="flex items-center gap-6">
|
||||
{/* Social Icons */}
|
||||
<div className="hidden md:flex items-center gap-5 text-black text-xl">
|
||||
<Link href="#">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="18"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
id="akarIconsPinterestFill0"
|
||||
fill="#fff"
|
||||
d="M0 0h24v24H0z"
|
||||
fill="currentColor"
|
||||
d="M14 13.5h2.5l1-4H14v-2c0-1.03 0-2 2-2h1.5V2.14c-.326-.043-1.557-.14-2.857-.14C11.928 2 10 3.657 10 6.7v2.8H7v4h3V22h4z"
|
||||
/>
|
||||
</defs>
|
||||
<g fill="none">
|
||||
<g
|
||||
// clip-path="url(#akarIconsPinterestFill1)"
|
||||
>
|
||||
<g
|
||||
// clip-path="url(#akarIconsPinterestFill2)"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M0 12c0 5.123 3.211 9.497 7.73 11.218c-.11-.937-.227-2.482.025-3.566c.217-.932 1.401-5.938 1.401-5.938s-.357-.715-.357-1.774c0-1.66.962-2.9 2.161-2.9c1.02 0 1.512.765 1.512 1.682c0 1.025-.653 2.557-.99 3.978c-.281 1.189.597 2.159 1.769 2.159c2.123 0 3.756-2.239 3.756-5.471c0-2.861-2.056-4.86-4.991-4.86c-3.398 0-5.393 2.549-5.393 5.184c0 1.027.395 2.127.889 2.726a.36.36 0 0 1 .083.343c-.091.378-.293 1.189-.332 1.355c-.053.218-.173.265-.4.159c-1.492-.694-2.424-2.875-2.424-4.627c0-3.769 2.737-7.229 7.892-7.229c4.144 0 7.365 2.953 7.365 6.899c0 4.117-2.595 7.431-6.199 7.431c-1.211 0-2.348-.63-2.738-1.373c0 0-.599 2.282-.744 2.84c-.282 1.084-1.064 2.456-1.549 3.235C9.584 23.815 10.77 24 12 24c6.627 0 12-5.373 12-12S18.627 0 12 0S0 5.373 0 12"
|
||||
/>
|
||||
</g>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="akarIconsPinterestFill1">
|
||||
<use href="#akarIconsPinterestFill0" />
|
||||
</clipPath>
|
||||
<clipPath id="akarIconsPinterestFill2">
|
||||
<use href="#akarIconsPinterestFill0" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
</g>
|
||||
</svg>
|
||||
</Link>
|
||||
|
||||
<Link href="#" aria-label="Vk">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="15"
|
||||
height="15"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
// fill-rule="evenodd"
|
||||
d="M23.45 5.948c.166-.546 0-.948-.795-.948H20.03c-.668 0-.976.347-1.143.73c0 0-1.335 3.196-3.226 5.272c-.612.602-.89.793-1.224.793c-.167 0-.418-.191-.418-.738V5.948c0-.656-.184-.948-.74-.948H9.151c-.417 0-.668.304-.668.593c0 .621.946.765 1.043 2.513v3.798c0 .833-.153.984-.487.984c-.89 0-3.055-3.211-4.34-6.885C4.45 5.288 4.198 5 3.527 5H.9c-.75 0-.9.347-.9.73c0 .682.89 4.07 4.145 8.551C6.315 17.341 9.37 19 12.153 19c1.669 0 1.875-.368 1.875-1.003v-2.313c0-.737.158-.884.687-.884c.39 0 1.057.192 2.615 1.667C19.11 18.216 19.403 19 20.405 19h2.625c.75 0 1.126-.368.91-1.096c-.238-.724-1.088-1.775-2.215-3.022c-.612-.71-1.53-1.475-1.809-1.858c-.389-.491-.278-.71 0-1.147c0 0 3.2-4.426 3.533-5.929"
|
||||
// clip-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</Link>
|
||||
<Link href="#" aria-label="Wifi">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="15"
|
||||
height="15"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M12 21q-1.05 0-1.775-.725T9.5 18.5t.725-1.775T12 16t1.775.725t.725 1.775t-.725 1.775T12 21m-5.65-5.65l-2.1-2.15q1.475-1.475 3.463-2.337T12 10t4.288.875t3.462 2.375l-2.1 2.1q-1.1-1.1-2.55-1.725T12 13t-3.1.625t-2.55 1.725M2.1 11.1L0 9q2.3-2.35 5.375-3.675T12 4t6.625 1.325T24 9l-2.1 2.1q-1.925-1.925-4.462-3.012T12 7T6.563 8.088T2.1 11.1"
|
||||
/>
|
||||
</svg>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<Link
|
||||
href="/auth"
|
||||
className="hover:underline flex items-center gap-1"
|
||||
>
|
||||
<Lock className="w-3 h-3" />
|
||||
Login
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-[#31942E] text-white">
|
||||
<div className="flex items-start justify-start md:justify-center md:items-center px-4 py-3 md:px-8 md:py-4">
|
||||
{/* Toggle Menu (Mobile Only) */}
|
||||
<button
|
||||
className="md:hidden flex items-center"
|
||||
onClick={toggleMenu}
|
||||
aria-label="Toggle menu"
|
||||
>
|
||||
<Menu className="h-6 w-6 text-white" />
|
||||
</button>
|
||||
|
||||
{/* Navigation Links (Desktop Only) */}
|
||||
<div className="hidden md:flex items-center md:gap-x-32 font-semibold text-sm">
|
||||
{navLinks.map((link, idx) => (
|
||||
<Link
|
||||
key={idx}
|
||||
href={link.href}
|
||||
className={`pl-4 pr-4 ${
|
||||
isActive(link.href)
|
||||
? "text-yellow-400"
|
||||
: "hover:text-yellow-400 text-white"
|
||||
}`}
|
||||
>
|
||||
{link.label}
|
||||
</svg>
|
||||
</Link>
|
||||
))}
|
||||
<Search className="w-5 h-5 hover:text-yellow-400 cursor-pointer ml-4" />
|
||||
|
||||
<Link href="#">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="18"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M7.91 20.889c8.302 0 12.845-6.885 12.845-12.845c0-.193 0-.387-.009-.58A9.2 9.2 0 0 0 23 5.121a9.2 9.2 0 0 1-2.597.713a4.54 4.54 0 0 0 1.99-2.5a9 9 0 0 1-2.87 1.091A4.5 4.5 0 0 0 16.23 3a4.52 4.52 0 0 0-4.516 4.516c0 .352.044.696.114 1.03a12.82 12.82 0 0 1-9.305-4.718a4.526 4.526 0 0 0 1.4 6.03a4.6 4.6 0 0 1-2.043-.563v.061a4.524 4.524 0 0 0 3.62 4.428a4.4 4.4 0 0 1-1.189.159q-.435 0-.845-.08a4.51 4.51 0 0 0 4.217 3.135a9.05 9.05 0 0 1-5.608 1.936A9 9 0 0 1 1 18.873a12.84 12.84 0 0 0 6.91 2.016"
|
||||
/>
|
||||
</svg>
|
||||
</Link>
|
||||
|
||||
<Link href="#">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="18"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M7.8 2h8.4C19.4 2 22 4.6 22 7.8v8.4a5.8 5.8 0 0 1-5.8 5.8H7.8C4.6 22 2 19.4 2 16.2V7.8A5.8 5.8 0 0 1 7.8 2m-.2 2A3.6 3.6 0 0 0 4 7.6v8.8C4 18.39 5.61 20 7.6 20h8.8a3.6 3.6 0 0 0 3.6-3.6V7.6C20 5.61 18.39 4 16.4 4zm9.65 1.5a1.25 1.25 0 0 1 1.25 1.25A1.25 1.25 0 0 1 17.25 8A1.25 1.25 0 0 1 16 6.75a1.25 1.25 0 0 1 1.25-1.25M12 7a5 5 0 0 1 5 5a5 5 0 0 1-5 5a5 5 0 0 1-5-5a5 5 0 0 1 5-5m0 2a3 3 0 0 0-3 3a3 3 0 0 0 3 3a3 3 0 0 0 3-3a3 3 0 0 0-3-3"
|
||||
/>
|
||||
</svg>
|
||||
</Link>
|
||||
|
||||
<Link href="#">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="18"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M12.244 4c.534.003 1.87.016 3.29.073l.504.022c1.429.067 2.857.183 3.566.38c.945.266 1.687 1.04 1.938 2.022c.4 1.56.45 4.602.456 5.339l.001.152v.174c-.007.737-.057 3.78-.457 5.339c-.254.985-.997 1.76-1.938 2.022c-.709.197-2.137.313-3.566.38l-.504.023c-1.42.056-2.756.07-3.29.072l-.235.001h-.255c-1.13-.007-5.856-.058-7.36-.476c-.944-.266-1.687-1.04-1.938-2.022c-.4-1.56-.45-4.602-.456-5.339v-.326c.006-.737.056-3.78.456-5.339c.254-.985.997-1.76 1.939-2.021c1.503-.419 6.23-.47 7.36-.476zM9.999 8.5v7l6-3.5z"
|
||||
/>
|
||||
</svg>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/* Middle Menu */}
|
||||
<div className="flex flex-row justify-between">
|
||||
<nav className="hidden md:flex items-center gap-10 text-sm font-semibold">
|
||||
<Link
|
||||
href="/"
|
||||
className={
|
||||
isActive("/")
|
||||
? "text-green-500 underline"
|
||||
: "text-black hover:text-green-500"
|
||||
}
|
||||
>
|
||||
Beranda
|
||||
</Link>
|
||||
|
||||
{isOpen && (
|
||||
<div className="md:hidden px-4 pb-4 flex flex-col gap-2 font-semibold text-sm bg-[#31942E]">
|
||||
{navLinks.map((link, idx) => (
|
||||
<Link
|
||||
key={idx}
|
||||
href={link.href}
|
||||
className={`${
|
||||
isActive(link.href)
|
||||
? "text-yellow-400"
|
||||
: "hover:text-yellow-400 text-white"
|
||||
}`}
|
||||
<Link
|
||||
href="/category/citizen-news"
|
||||
className={
|
||||
isActive("/category/citizen-news")
|
||||
? "text-green-500 underline"
|
||||
: "text-black hover:text-green-500"
|
||||
}
|
||||
>
|
||||
Berita Warga
|
||||
</Link>
|
||||
|
||||
<Link
|
||||
href="/category/development"
|
||||
className={
|
||||
isActive("/category/development")
|
||||
? "text-green-500 underline"
|
||||
: "text-black hover:text-green-500"
|
||||
}
|
||||
>
|
||||
Pembangunan
|
||||
</Link>
|
||||
|
||||
<Link
|
||||
href="/category/health"
|
||||
className={
|
||||
isActive("/category/health")
|
||||
? "text-green-500 underline"
|
||||
: "text-black hover:text-green-500"
|
||||
}
|
||||
>
|
||||
Kesehatan
|
||||
</Link>
|
||||
</nav>
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<button
|
||||
// onClick={() => document.documentElement.classList.toggle("dark")}
|
||||
className="w-10 h-5 rounded-full bg-gray-300 dark:bg-gray-700 relative transition-all"
|
||||
>
|
||||
<div className="w-5 h-5 bg-white dark:bg-black rounded-full shadow absolute top-0 left-0 dark:left-5 transition-all"></div>
|
||||
</button>
|
||||
|
||||
{/* BURGER BUTTON (mobile menu) */}
|
||||
<button className="md:hidden p-2 rounded-lg border">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
strokeWidth={2}
|
||||
stroke="currentColor"
|
||||
className="w-6 h-6"
|
||||
>
|
||||
{link.label}
|
||||
</Link>
|
||||
))}
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
d="M4 6h16M4 12h16M4 18h16"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
<button className="p-2 border rounded-full">
|
||||
<Search size={15} />
|
||||
</button>
|
||||
<Link href={"/auth"}>
|
||||
<button className="bg-green-600 text-white px-5 py-2 rounded-full text-sm font-semibold">
|
||||
LOGIN
|
||||
</button>
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Navbar;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ type postsData = {
|
|||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
publishedAt: string;
|
||||
categoryName: string;
|
||||
createdAt: string;
|
||||
slug: string;
|
||||
|
|
@ -118,8 +119,8 @@ export default function Beranda() {
|
|||
{posts
|
||||
.filter((post) =>
|
||||
post.categories?.some(
|
||||
(category) => category.title.toLowerCase() === "pembangunan"
|
||||
)
|
||||
(category) => category.title.toLowerCase() === "pembangunan",
|
||||
),
|
||||
)
|
||||
.slice(0, 6) // Ambil 4 artikel pertama setelah difilter
|
||||
.map((post, index) => (
|
||||
|
|
@ -150,11 +151,18 @@ export default function Beranda() {
|
|||
<Clock className="w-3 h-3" />
|
||||
<span>
|
||||
{post?.customCreatorName || post.createdByName} -{" "}
|
||||
{new Date(post.createdAt).toLocaleDateString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
})}
|
||||
{new Date(post.publishedAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -207,8 +215,8 @@ export default function Beranda() {
|
|||
{posts
|
||||
.filter((post) =>
|
||||
post.categories?.some(
|
||||
(category) => category.title.toLowerCase() === "kesehatan"
|
||||
)
|
||||
(category) => category.title.toLowerCase() === "kesehatan",
|
||||
),
|
||||
)
|
||||
.slice(0, 6) // Ambil 4 artikel pertama setelah difilter
|
||||
.map((post, index) => (
|
||||
|
|
|
|||
|
|
@ -0,0 +1,126 @@
|
|||
"use client";
|
||||
|
||||
import { getListArticle } from "@/service/article";
|
||||
import { ChevronDown } from "lucide-react";
|
||||
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;
|
||||
slug: string;
|
||||
createdAt: string;
|
||||
publishedAt: string;
|
||||
createdByName: string;
|
||||
customCreatorName: string;
|
||||
thumbnailUrl: string;
|
||||
categories: { title: string }[];
|
||||
files: { fileUrl: string; file_alt: string }[];
|
||||
};
|
||||
|
||||
export default function OpinionNews() {
|
||||
const [page, setPage] = useState(1);
|
||||
const [totalPage, setTotalPage] = useState(1);
|
||||
const [articles, setArticles] = useState<Article[]>([]);
|
||||
const [showData, setShowData] = useState("6");
|
||||
const [search] = useState("");
|
||||
const [selectedCategories] = useState<any>("");
|
||||
const [startDateValue] = 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 (
|
||||
<section className="max-w-screen-xl mx-auto px-4 py-10">
|
||||
<div className="">
|
||||
{/* TITLE */}
|
||||
<div className="mb-4">
|
||||
<h2 className="text-xl font-black text-[#000]">BERITA OPINI</h2>
|
||||
<div className="w-10 h-1 bg-green-600 mt-1 rounded"></div>
|
||||
</div>
|
||||
|
||||
{/* GRID 4 KOLOM */}
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-6">
|
||||
{articles.slice(0, 4).map((item) => (
|
||||
<Link href={`/details/${item.slug}`} key={item.id}>
|
||||
<div>
|
||||
{/* GAMBAR */}
|
||||
<div className="relative w-full h-56 rounded-lg overflow-hidden">
|
||||
<Image
|
||||
src={item.thumbnailUrl || "/placeholder.jpg"}
|
||||
alt={item.title}
|
||||
fill
|
||||
className="object-cover"
|
||||
/>
|
||||
|
||||
{/* BADGE CATEGORY DI DALAM GAMBAR */}
|
||||
<div className="absolute bottom-2 left-2">
|
||||
<span className="px-3 py-1 text-[10px] font-semibold bg-green-600 text-white rounded">
|
||||
{item.categoryName || "Kategori"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* JUDUL */}
|
||||
<h3 className="mt-2 text-base font-bold leading-snug line-clamp-2">
|
||||
{item.title}
|
||||
</h3>
|
||||
|
||||
{/* AUTHOR + DATE */}
|
||||
<div className="text-[11px] mt-2 flex items-center gap-1 text-gray-700">
|
||||
<span className="font-semibold">
|
||||
By {item.customCreatorName || item.createdByName || "Admin"}
|
||||
</span>
|
||||
<span className="text-yellow-500">-</span>
|
||||
<span>
|
||||
{new Date(item.publishedAt).toLocaleDateString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
})}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="relative h-[160px] w-full overflow-hidden rounded-xl mt-6">
|
||||
<Image
|
||||
src="/image-kolom.png"
|
||||
alt="Kolom PPS"
|
||||
fill
|
||||
className="object-contain bg-white"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
import { Eye, Heart, MessageCircle } from "lucide-react";
|
||||
import Image from "next/image";
|
||||
|
||||
interface VideoItem {
|
||||
id: number;
|
||||
title: string;
|
||||
thumbnail: string;
|
||||
duration: string;
|
||||
publishedAt: string;
|
||||
views: string;
|
||||
likes: string;
|
||||
comments: string;
|
||||
}
|
||||
|
||||
const sampleVideos: VideoItem[] = [
|
||||
{
|
||||
id: 1,
|
||||
title: "Cuplikan Kegiatan Presiden di IKN",
|
||||
thumbnail: "/yt/thumb1.jpg",
|
||||
duration: "12:30",
|
||||
publishedAt: "2 jam yang lalu",
|
||||
views: "12K",
|
||||
likes: "230",
|
||||
comments: "45",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: "Pembangunan MRT Fase Berikutnya Resmi Dimulai",
|
||||
thumbnail: "/yt/thumb2.jpg",
|
||||
duration: "08:12",
|
||||
publishedAt: "5 jam yang lalu",
|
||||
views: "9.4K",
|
||||
likes: "180",
|
||||
comments: "30",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: "Wilayah Indonesia Siap Hadapi Cuaca Ekstrem",
|
||||
thumbnail: "/yt/thumb3.jpg",
|
||||
duration: "05:50",
|
||||
publishedAt: "1 hari lalu",
|
||||
views: "21K",
|
||||
likes: "540",
|
||||
comments: "121",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
title: "Peningkatan Ekonomi Regional Terus Dijaga",
|
||||
thumbnail: "/yt/thumb4.jpg",
|
||||
duration: "10:44",
|
||||
publishedAt: "2 hari lalu",
|
||||
views: "18K",
|
||||
likes: "420",
|
||||
comments: "88",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
title: "Laporan Khusus Perkembangan Industri Kreatif",
|
||||
thumbnail: "/yt/thumb5.jpg",
|
||||
duration: "14:02",
|
||||
publishedAt: "3 hari lalu",
|
||||
views: "30K",
|
||||
likes: "830",
|
||||
comments: "200",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
title: "Paparan Menteri Perhubungan Soal Transportasi",
|
||||
thumbnail: "/yt/thumb6.jpg",
|
||||
duration: "07:21",
|
||||
publishedAt: "4 hari lalu",
|
||||
views: "9K",
|
||||
likes: "114",
|
||||
comments: "26",
|
||||
},
|
||||
];
|
||||
|
||||
export default function YouTubeSection() {
|
||||
return (
|
||||
<section className="max-w-7xl mx-auto px-4 py-8">
|
||||
{/* Header Channel */}
|
||||
<div className="flex items-center gap-4 mb-6">
|
||||
<Image
|
||||
src="/yt-logo.png"
|
||||
alt="Logo Channel"
|
||||
width={70}
|
||||
height={70}
|
||||
className="rounded-full"
|
||||
/>
|
||||
<div>
|
||||
<h2 className="text-xl font-semibold">YouTube • Channel Resmi</h2>
|
||||
<p className="text-sm text-gray-600">
|
||||
Lebih dari 3.5 juta pengikut • 12k video
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<a
|
||||
href="#"
|
||||
className="ml-auto bg-red-600 text-white px-4 py-2 rounded-lg font-semibold"
|
||||
>
|
||||
Subscribe
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{/* Grid Video */}
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{sampleVideos.map((v) => (
|
||||
<div key={v.id} className="cursor-pointer">
|
||||
<div className="relative w-full h-44">
|
||||
<Image
|
||||
src={v.thumbnail}
|
||||
alt={v.title}
|
||||
fill
|
||||
className="rounded-lg object-cover"
|
||||
/>
|
||||
|
||||
<span className="absolute bottom-1 right-1 bg-black/80 text-white text-xs px-2 py-1 rounded">
|
||||
{v.duration}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<h3 className="font-semibold mt-2 leading-tight line-clamp-2">
|
||||
{v.title}
|
||||
</h3>
|
||||
|
||||
<p className="text-sm text-gray-600">{v.publishedAt}</p>
|
||||
|
||||
<div className="flex items-center gap-4 text-sm text-gray-700 mt-1">
|
||||
<span className="flex items-center gap-1">
|
||||
<Eye size={16} /> {v.views}
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<Heart size={16} /> {v.likes}
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<MessageCircle size={16} /> {v.comments}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Pagination */}
|
||||
<div className="flex justify-center mt-8">
|
||||
<button className="px-5 py-2 rounded-lg border hover:bg-gray-100">
|
||||
Lihat Selanjutnya →
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
|
@ -316,7 +316,7 @@ export default function ArticleTable() {
|
|||
return cellValue;
|
||||
}
|
||||
},
|
||||
[article, page]
|
||||
[article, page],
|
||||
);
|
||||
|
||||
let typingTimer: NodeJS.Timeout;
|
||||
|
|
@ -445,8 +445,8 @@ export default function ArticleTable() {
|
|||
</div>
|
||||
</div>
|
||||
<div className="w-full overflow-x-hidden">
|
||||
<div className="w-full mx-auto overflow-x-hidden">
|
||||
<Table className="w-full table-fixed border text-sm">
|
||||
<div className="w-full overflow-x-auto">
|
||||
<Table className="min-w-[1000px] w-full table-auto border text-sm">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
{(username === "admin-mabes"
|
||||
|
|
@ -455,7 +455,18 @@ export default function ArticleTable() {
|
|||
).map((column) => (
|
||||
<TableHead
|
||||
key={column.uid}
|
||||
className="truncate bg-white dark:bg-black text-black dark:text-white border-b text-md"
|
||||
className={`bg-white dark:bg-black text-black dark:text-white
|
||||
text-sm font-semibold border-b px-3 py-3
|
||||
${
|
||||
column.uid === "no"
|
||||
? "min-w-[60px] text-center"
|
||||
: column.uid === "title"
|
||||
? "min-w-[280px]"
|
||||
: column.uid === "actions"
|
||||
? "min-w-[100px] text-center"
|
||||
: "min-w-[160px]"
|
||||
}
|
||||
`}
|
||||
>
|
||||
{column.name}
|
||||
</TableHead>
|
||||
|
|
@ -472,7 +483,17 @@ export default function ArticleTable() {
|
|||
).map((column) => (
|
||||
<TableCell
|
||||
key={column.uid}
|
||||
className="truncate text-black dark:text-white max-w-[200px]"
|
||||
className={`text-black dark:text-white text-sm px-3 py-3 align-top
|
||||
${
|
||||
column.uid === "no"
|
||||
? "min-w-[60px] text-center font-medium"
|
||||
: column.uid === "title"
|
||||
? "min-w-[280px] whitespace-normal break-words leading-snug"
|
||||
: column.uid === "actions"
|
||||
? "min-w-[100px] text-center"
|
||||
: "min-w-[160px] whitespace-normal break-words"
|
||||
}
|
||||
`}
|
||||
>
|
||||
{renderCell(item, column.uid)}
|
||||
</TableCell>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import * as React from "react"
|
||||
import * as React from "react";
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
||||
return (
|
||||
|
|
@ -15,7 +15,7 @@ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export { Input }
|
||||
export { Input };
|
||||
|
|
|
|||
|
|
@ -1,15 +1,13 @@
|
|||
import type { NextConfig } from "next";
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
images: {
|
||||
domains: ["mikulnews.com", "dev.mikulnews.com"],
|
||||
},
|
||||
eslint: {
|
||||
ignoreDuringBuilds: true,
|
||||
},
|
||||
// Add experimental features for better chunk handling
|
||||
experimental: {
|
||||
optimizePackageImports: ['@ckeditor/ckeditor5-react', 'react-apexcharts'],
|
||||
optimizePackageImports: ["@ckeditor/ckeditor5-react", "react-apexcharts"],
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -39,12 +39,12 @@
|
|||
"js-cookie": "^3.0.5",
|
||||
"lightningcss": "^1.30.1",
|
||||
"lucide-react": "^0.525.0",
|
||||
"next": "15.3.4",
|
||||
"react": "^19.0.0",
|
||||
"next": "^16.1.1",
|
||||
"react": "^19.2.3",
|
||||
"react-apexcharts": "^1.7.0",
|
||||
"react-datepicker": "^8.4.0",
|
||||
"react-day-picker": "^9.7.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"react-dom": "^19.2.4",
|
||||
"react-dropzone": "^14.3.8",
|
||||
"react-hook-form": "^7.59.0",
|
||||
"react-password-checklist": "^1.8.1",
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
|
|
@ -136,6 +136,13 @@ export async function uploadArticleFile(id: string, data: any) {
|
|||
return await httpPostInterceptor(`/article-files/${id}`, data, headers);
|
||||
}
|
||||
|
||||
export async function getArticleFiles() {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
};
|
||||
return await httpGet(`/article-files`, headers);
|
||||
}
|
||||
|
||||
export async function uploadArticleThumbnail(id: string, data: any) {
|
||||
const headers = {
|
||||
"content-type": "multipart/form-data",
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import axios from "axios";
|
||||
|
||||
const baseURL = "https://dev.mikulnews.com/api";
|
||||
const baseURL = "https://mikulnews.com/api";
|
||||
|
||||
const axiosBaseInstance = axios.create({
|
||||
baseURL,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Client-Key": "bb65b1ad-e954-4a1a-b4d0-74df5bb0b640"
|
||||
"X-Client-Key": "bb65b1ad-e954-4a1a-b4d0-74df5bb0b640",
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import axios from "axios";
|
|||
import { postSignIn } from "../master-user";
|
||||
import Cookies from "js-cookie";
|
||||
|
||||
const baseURL = "https://dev.mikulnews.com/api";
|
||||
const baseURL = "https://mikulnews.com/api";
|
||||
|
||||
const refreshToken = Cookies.get("refresh_token");
|
||||
|
||||
|
|
@ -10,7 +10,7 @@ const axiosInterceptorInstance = axios.create({
|
|||
baseURL,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Client-Key": "bb65b1ad-e954-4a1a-b4d0-74df5bb0b640"
|
||||
"X-Client-Key": "bb65b1ad-e954-4a1a-b4d0-74df5bb0b640",
|
||||
},
|
||||
withCredentials: true,
|
||||
});
|
||||
|
|
@ -28,7 +28,7 @@ axiosInterceptorInstance.interceptors.request.use(
|
|||
},
|
||||
(error) => {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
// Response interceptor
|
||||
|
|
@ -66,7 +66,7 @@ axiosInterceptorInstance.interceptors.response.use(
|
|||
}
|
||||
|
||||
return Promise.reject(error);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
export default axiosInterceptorInstance;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,121 @@
|
|||
/* ========== CKEditor Wrapper ========== */
|
||||
.ckeditor-wrapper {
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
box-shadow:
|
||||
0 1px 3px 0 rgba(0, 0, 0, 0.1),
|
||||
0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
/* ========== Main Editor Container ========== */
|
||||
.ckeditor-wrapper .ck.ck-editor__main {
|
||||
min-height: var(--editor-min-height, 400px);
|
||||
max-height: var(--editor-max-height, 600px);
|
||||
}
|
||||
|
||||
/* ========== Editable Content Area (ClassicEditor) ========== */
|
||||
.ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline {
|
||||
min-height: calc(var(--editor-min-height, 400px) - 50px);
|
||||
max-height: calc(var(--editor-max-height, 600px) - 50px);
|
||||
overflow-y: auto !important;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: #cbd5e1 #f1f5f9;
|
||||
background: #fff !important;
|
||||
color: #111 !important;
|
||||
font-family:
|
||||
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
font-size: 14px;
|
||||
line-height: 1.6;
|
||||
padding: 1rem;
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
/* ========== Headings and Text Formatting ========== */
|
||||
.ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline h1,
|
||||
.ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline h2,
|
||||
.ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline h3,
|
||||
.ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline h4,
|
||||
.ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline h5,
|
||||
.ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline h6 {
|
||||
margin: 1em 0 0.5em 0;
|
||||
color: inherit !important;
|
||||
}
|
||||
|
||||
.ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline p {
|
||||
margin: 0.5em 0 !important;
|
||||
}
|
||||
|
||||
.ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline ul,
|
||||
.ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline ol {
|
||||
margin: 0.5em 0;
|
||||
padding-left: 2em;
|
||||
}
|
||||
|
||||
.ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline blockquote {
|
||||
margin: 1em 0;
|
||||
padding: 0.5em 1em;
|
||||
border-left: 4px solid #d1d5db;
|
||||
background-color: #f9fafb;
|
||||
color: inherit !important;
|
||||
}
|
||||
|
||||
/* ========== Dark Mode Support ========== */
|
||||
.dark .ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline {
|
||||
background: #111 !important;
|
||||
color: #f9fafb !important;
|
||||
}
|
||||
|
||||
.dark .ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline h1,
|
||||
.dark .ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline h2,
|
||||
.dark .ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline h3,
|
||||
.dark .ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline h4,
|
||||
.dark .ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline h5,
|
||||
.dark .ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline h6 {
|
||||
color: #f9fafb !important;
|
||||
}
|
||||
|
||||
.dark .ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline blockquote {
|
||||
background-color: #1f2937 !important;
|
||||
border-left-color: #374151 !important;
|
||||
color: #f3f4f6 !important;
|
||||
}
|
||||
|
||||
/* ========== Custom Scrollbars (Light & Dark) ========== */
|
||||
.ckeditor-wrapper .ck.ck-content.ck-editor__editable_inline::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
.ckeditor-wrapper
|
||||
.ck.ck-content.ck-editor__editable_inline::-webkit-scrollbar-track {
|
||||
background: #f1f5f9;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.ckeditor-wrapper
|
||||
.ck.ck-content.ck-editor__editable_inline::-webkit-scrollbar-thumb {
|
||||
background: #cbd5e1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.ckeditor-wrapper
|
||||
.ck.ck-content.ck-editor__editable_inline::-webkit-scrollbar-thumb:hover {
|
||||
background: #94a3b8;
|
||||
}
|
||||
|
||||
.dark
|
||||
.ckeditor-wrapper
|
||||
.ck.ck-content.ck-editor__editable_inline::-webkit-scrollbar-track {
|
||||
background: #1f2937;
|
||||
}
|
||||
|
||||
.dark
|
||||
.ckeditor-wrapper
|
||||
.ck.ck-content.ck-editor__editable_inline::-webkit-scrollbar-thumb {
|
||||
background: #4b5563;
|
||||
}
|
||||
|
||||
.dark
|
||||
.ckeditor-wrapper
|
||||
.ck.ck-content.ck-editor__editable_inline::-webkit-scrollbar-thumb:hover {
|
||||
background: #6b7280;
|
||||
}
|
||||
|
|
@ -1,7 +1,11 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2017",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
|
|
@ -11,7 +15,7 @@
|
|||
"moduleResolution": "bundler",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"jsx": "react-jsx",
|
||||
"incremental": true,
|
||||
"plugins": [
|
||||
{
|
||||
|
|
@ -19,9 +23,19 @@
|
|||
}
|
||||
],
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
"@/*": [
|
||||
"./*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
".next/types/**/*.ts",
|
||||
".next/dev/types/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue