"use client"; import { convertDateFormat, formatMonthString, formatTextToHtmlTag, } from "@/utils/global"; import Image from "next/image"; import { CalendarIcon, ChevronLeftIcon, ChevronRightIcon, ClockIcon, EyeIcon, EyeIconMdi, FacebookIcon, SquareFacebookIcon, SquareLinkedInIcon, SquareWhatsappIcon, SquareXIcon, UserIcon, } from "../icons"; import { Button } from "@nextui-org/button"; import { usePathname } from "next/navigation"; import Link from "next/link"; export default function DetailNews(props: { data: any }) { const { data } = props; const pathname = usePathname(); const shareText = "Cek situs ini!"; const handleShare = (platform: string) => { let shareLink = ""; const urls = "https://kontenhumas.com/" + pathname; switch (platform) { case "facebook": shareLink = `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent( urls )}`; break; case "x": shareLink = `https://x.com/intent/tweet?url=${encodeURIComponent( urls )}&text=${encodeURIComponent(shareText)}`; break; case "linkedin": shareLink = `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent( urls )}`; break; case "whatsapp": shareLink = `https://wa.me/?text=${encodeURIComponent( shareText + " " + urls )}`; break; default: break; } const popupWidth = 800; const popupHeight = 600; const left = window.screenX + (window.innerWidth - popupWidth) / 2; const top = window.screenY + (window.innerHeight - popupHeight) / 2; window.open( shareLink, "_blank", `width=${popupWidth},height=${popupHeight},top=${top},left=${left},resizable=no,scrollbars=no,toolbar=no,menubar=no,status=no` ); }; return (

{data?.title}

{data?.createdByName}

{formatMonthString(data?.updatedAt)}

{`${new Date(data?.updatedAt) .getHours() .toString() .padStart(2, "0")}:${new Date(data?.updatedAt) .getMinutes() .toString() .padStart(2, "0")}`}

{data?.viewCount === null ? 0 : data?.viewCount}

NextUI hero Image
{/*
Sebelumnya Selanjutnya
*/}
); }