Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/app/(main)/_components/parts/Opinions/PersonData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
/>
<div className="flex flex-col">
<span className="text-[18px] sm:text-xl font-bold text-primary-400">
Expand Down
32 changes: 31 additions & 1 deletion src/app/(main)/berita/[slug]/_components/MdViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -61,6 +63,33 @@ const CustomCode = ({
/>
);

const CustomImage = ({
node,
height,
width,
alt,
src,
...props
}: ClassAttributes<HTMLElement> &
ImgHTMLAttributes<HTMLImageElement> &
ExtraProps) => {
const parsedHeight =
typeof height === "number" ? height : height ? parseInt(height) : 600;
const parsedWidth =
typeof width === "number" ? width : width ? parseInt(width) : 600;

return (
<Image
alt={alt || "Illustrasi Artikel"}
className={cn(!height || !width ? "w-full" : "")}
src={src!}
height={parsedHeight}
width={parsedWidth}
{...props}
/>
);
};

export function MdViewer({ markdown }: Readonly<MdViewerProps>) {
return (
<Markdown
Expand All @@ -69,6 +98,7 @@ export function MdViewer({ markdown }: Readonly<MdViewerProps>) {
ol: CustomOl,
pre: CustomPre,
code: CustomCode,
img: CustomImage,
}}
className="prose"
rehypePlugins={[rehypeRaw, rehypeHighlight]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default function RelatedNewsFigure({
<Image
src={post.thumbnail}
alt="wao"
unoptimized
height={200}
width={372}
className="h-full w-full object-cover rounded-[20px]"
Expand Down Expand Up @@ -45,7 +44,6 @@ export default function RelatedNewsFigure({
<Image
src={post.user.user_pic}
alt={post.user.name + "'s Pfp"}
unoptimized
height={28}
width={28}
className="h-7 w-7 object-cover rounded-full"
Expand Down
2 changes: 0 additions & 2 deletions src/app/(main)/berita/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export default async function Post({
<Image
src={post?.user.user_pic}
alt={post?.user.name + "'s Pfp"}
unoptimized
height={28}
width={28}
className="h-7 w-7 object-cover rounded-full"
Expand All @@ -121,7 +120,6 @@ export default async function Post({
width={768}
height={450}
className="w-full h-full rounded-[20px]"
unoptimized
/>
</div>
<div className="w-full">
Expand Down
2 changes: 0 additions & 2 deletions src/app/(main)/berita/_components/parts/WideNewsFigure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export function WideNewsFigure({
width={140}
height={140}
className="h-[140px] w-[140px] rounded-2xl object-cover"
unoptimized
/>
</div>
<div className="w-full flex flex-col gap-0 md:gap-[52px] text-wrap">
Expand All @@ -37,7 +36,6 @@ export function WideNewsFigure({
<Image
src={post.user.user_pic}
alt={post.user.name + "'s Pfp"}
unoptimized
height={28}
width={28}
className="h-7 w-7 object-cover rounded-full"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export default function OrgGallery({
alt="Image"
width={587}
height={407}
unoptimized
className="w-full h-full"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export default function OrganizationSection({
src={organisasi.logo}
width={62}
height={62}
unoptimized
className="w-[62px] h-[62px] object-cover"
/>
<div className="flex flex-col gap-[6px] w-[80%]">
Expand Down
2 changes: 0 additions & 2 deletions src/app/_components/global/NewsFigure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export function NewsFigure({ post }: Readonly<{ post: PostWithTagsAndUser }>) {
<Image
src={post.thumbnail}
alt={post.slug}
unoptimized
height={200}
width={372}
className="h-full w-full object-cover rounded-[20px]"
Expand Down Expand Up @@ -56,7 +55,6 @@ export function NewsFigure({ post }: Readonly<{ post: PostWithTagsAndUser }>) {
<Image
src={post.user.user_pic}
alt={post.user.name + "'s Pfp"}
unoptimized
height={28}
width={28}
className="h-7 w-7 object-cover rounded-full"
Expand Down