@@ -3,25 +3,34 @@ import classnames from "classnames";
33import Link from "next/link";
44export default function Post({ post }) {
55 return ["featured-1", "featured-2", "featured-3"].map((feat) => {
6+ const childPath =
7+ post[feat] && post[feat]?.matchedPost?.type === "Application"
8+ ? `${post[feat]?.matchedPost.ship}/${post[feat].matchedPost.slug}`
9+ : `${post[feat].matchedPost?.slug}`;
10+ const href = post[feat]?.matchedPost
11+ ? `/${post[feat].matchedPost.type.toLowerCase()}s/${childPath}`
12+ : null;
613 return post?.[feat] ? (
7− <div
8− className="mt-8 mb-24"
9− id={post?.[feat].title.toLowerCase().replace(/ /, "-")}
10− >
11− <div className="flex space-x-4 items-center">
12− <img
13− className="rounded-xl w-24 object-cover"
14− src={post[feat].image}
15− />
16− <div className="flex flex-col">
17− <h4 className="text-xl pb-1 font-bold">{post?.[feat].title}</h4>
18− {badge(post[feat].type)}
14+ <Link href={href || "#"}>
15+ <div
16+ className="mt-8 mb-24 cursor-pointer"
17+ id={post?.[feat].title.toLowerCase().replace(/ /, "-")}
18+ >
19+ <div className="flex space-x-4 items-center">
20+ <img
21+ className="rounded-xl w-24 object-cover"
22+ src={post[feat].image}
23+ />
24+ <div className="flex flex-col">
25+ <h4 className="text-xl pb-1 font-bold">{post?.[feat].title}</h4>
26+ {badge(post[feat].type)}
27+ </div>
28+ </div>
29+ <div className="markdown mt-8">
30+ <Markdown.render content={JSON.parse(post[feat].content)} />
1931 </div>
2032 </div>
21− <div className="markdown mt-8">
22− <Markdown.render content={JSON.parse(post[feat].content)} />
23− </div>
24− </div>
33+ </Link>
2534 ) : null;
2635 });
2736}