diff --git a/src/app/(main)/_components/parts/Opinions/PersonData.tsx b/src/app/(main)/_components/parts/Opinions/PersonData.tsx index 1fcfe320..ccf54a8c 100644 --- a/src/app/(main)/_components/parts/Opinions/PersonData.tsx +++ b/src/app/(main)/_components/parts/Opinions/PersonData.tsx @@ -19,7 +19,6 @@ export default function PersonData({ width={44} height={44} className="h-full max-h-[44px] w-full max-w-[44px] rounded-full" - unoptimized />
diff --git a/src/app/(main)/berita/[slug]/_components/MdViewer.tsx b/src/app/(main)/berita/[slug]/_components/MdViewer.tsx index eb601c26..6940e457 100644 --- a/src/app/(main)/berita/[slug]/_components/MdViewer.tsx +++ b/src/app/(main)/berita/[slug]/_components/MdViewer.tsx @@ -3,9 +3,11 @@ import rehypeHighlight from "rehype-highlight"; import rehypeRaw from "rehype-raw"; import remarkGfm from "remark-gfm"; import remarkRehype from "remark-rehype"; -import { ClassAttributes, HTMLAttributes } from "react"; +import { ClassAttributes, HTMLAttributes, ImgHTMLAttributes } from "react"; import "../github-dark.min.css"; +import Image from "@/app/_components/global/Image"; +import cn from "@/lib/clsx"; interface MdViewerProps { markdown: string; @@ -61,6 +63,33 @@ const CustomCode = ({ /> ); +const CustomImage = ({ + node, + height, + width, + alt, + src, + ...props +}: ClassAttributes & + ImgHTMLAttributes & + ExtraProps) => { + const parsedHeight = + typeof height === "number" ? height : height ? parseInt(height) : 600; + const parsedWidth = + typeof width === "number" ? width : width ? parseInt(width) : 600; + + return ( + {alt + ); +}; + export function MdViewer({ markdown }: Readonly) { return ( ) { ol: CustomOl, pre: CustomPre, code: CustomCode, + img: CustomImage, }} className="prose" rehypePlugins={[rehypeRaw, rehypeHighlight]} diff --git a/src/app/(main)/berita/[slug]/_components/RelatedNewsFigure.tsx b/src/app/(main)/berita/[slug]/_components/RelatedNewsFigure.tsx index fc6194d6..da00301c 100644 --- a/src/app/(main)/berita/[slug]/_components/RelatedNewsFigure.tsx +++ b/src/app/(main)/berita/[slug]/_components/RelatedNewsFigure.tsx @@ -14,7 +14,6 @@ export default function RelatedNewsFigure({ wao
diff --git a/src/app/(main)/berita/_components/parts/WideNewsFigure.tsx b/src/app/(main)/berita/_components/parts/WideNewsFigure.tsx index ff9aaa30..08900e61 100644 --- a/src/app/(main)/berita/_components/parts/WideNewsFigure.tsx +++ b/src/app/(main)/berita/_components/parts/WideNewsFigure.tsx @@ -16,7 +16,6 @@ export function WideNewsFigure({ width={140} height={140} className="h-[140px] w-[140px] rounded-2xl object-cover" - unoptimized />
@@ -37,7 +36,6 @@ export function WideNewsFigure({ {post.user.name
diff --git a/src/app/(main)/organisasi/[period]/_components/OrganizationSection.tsx b/src/app/(main)/organisasi/[period]/_components/OrganizationSection.tsx index 87747b29..1d79cab4 100644 --- a/src/app/(main)/organisasi/[period]/_components/OrganizationSection.tsx +++ b/src/app/(main)/organisasi/[period]/_components/OrganizationSection.tsx @@ -39,7 +39,6 @@ export default function OrganizationSection({ src={organisasi.logo} width={62} height={62} - unoptimized className="w-[62px] h-[62px] object-cover" />
diff --git a/src/app/_components/global/NewsFigure.tsx b/src/app/_components/global/NewsFigure.tsx index 48b9ecde..f4693591 100644 --- a/src/app/_components/global/NewsFigure.tsx +++ b/src/app/_components/global/NewsFigure.tsx @@ -25,7 +25,6 @@ export function NewsFigure({ post }: Readonly<{ post: PostWithTagsAndUser }>) { {post.slug}) {