From 84b84c0fec662e227f61befbd3f6d91ea5d678a7 Mon Sep 17 00:00:00 2001
From: Rama Priyanto
Date: Tue, 24 Feb 2026 14:09:04 +0700
Subject: [PATCH] fix:detail news-> get thumbnail to content
---
components/page/detail-news.tsx | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/components/page/detail-news.tsx b/components/page/detail-news.tsx
index 0cfb100..b473064 100644
--- a/components/page/detail-news.tsx
+++ b/components/page/detail-news.tsx
@@ -67,22 +67,22 @@ export default function DetailNews(props: { data: any; listArticle: any }) {
switch (platform) {
case "facebook":
shareLink = `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(
- urls
+ urls,
)}`;
break;
case "x":
shareLink = `https://x.com/intent/tweet?url=${encodeURIComponent(
- urls
+ urls,
)}&text=${encodeURIComponent(shareText)}`;
break;
case "linkedin":
shareLink = `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(
- urls
+ urls,
)}`;
break;
case "whatsapp":
shareLink = `https://wa.me/?text=${encodeURIComponent(
- shareText + " " + urls
+ shareText + " " + urls,
)}`;
break;
default:
@@ -97,14 +97,14 @@ export default function DetailNews(props: { data: any; listArticle: any }) {
window.open(
shareLink,
"_blank",
- `width=${popupWidth},height=${popupHeight},top=${top},left=${left},resizable=no,scrollbars=no,toolbar=no,menubar=no,status=no`
+ `width=${popupWidth},height=${popupHeight},top=${top},left=${left},resizable=no,scrollbars=no,toolbar=no,menubar=no,status=no`,
);
};
useEffect(() => {
if (listArticle) {
const index = listArticle?.findIndex(
- (item: any) => item?.id === data?.id
+ (item: any) => item?.id === data?.id,
);
if (index - 1 == -1) {
setPrevArticle("");
@@ -165,6 +165,18 @@ export default function DetailNews(props: { data: any; listArticle: any }) {
{data?.viewCount === null ? 0 : data?.viewCount}
+ {data?.files?.length < 1 && data?.thumbnailUrl !== "" && (
+
+ )}{" "}
+
{data?.files?.length > 0 ? (
data.files[0]?.file_name.split(".")[1].includes("doc") ||
@@ -273,11 +285,10 @@ export default function DetailNews(props: { data: any; listArticle: any }) {
))}
-
TAGS
@@ -306,7 +317,7 @@ export default function DetailNews(props: { data: any; listArticle: any }) {
{tag}
- )
+ ),
)}