tangled
alpha
login
or
join now
baileykane.co
/
personal-website-next
0
fork
atom
this repo has no description
www.baileykane.co/
0
fork
atom
overview
issues
pulls
pipelines
Use BlogPostContent for each blog post
baileykane.co
1 year ago
ec35949b
b49cd84a
+36
-3
2 changed files
expand all
collapse all
unified
split
components
BlogPostContent.tsx
pageContent
blog
BlogPostPage.tsx
+34
components/BlogPostContent.tsx
···
1
1
+
import { micromark } from "micromark";
2
2
+
import BlogPostType from "@/types/BlogPost";
3
3
+
4
4
+
export default function BlogPostContent({ blogPost }): React.ReactElement {
5
5
+
const { title, slug, content, publishedDate, updatedDate } =
6
6
+
blogPost as BlogPostType;
7
7
+
8
8
+
const formattedPublishedDate = new Date(publishedDate).toLocaleDateString(
9
9
+
"en-US",
10
10
+
{
11
11
+
month: "long",
12
12
+
day: "numeric",
13
13
+
year: "numeric",
14
14
+
}
15
15
+
);
16
16
+
17
17
+
const formattedUpdatedDate = new Date(updatedDate).toLocaleDateString(
18
18
+
"en-US",
19
19
+
{
20
20
+
month: "long",
21
21
+
day: "numeric",
22
22
+
year: "numeric",
23
23
+
}
24
24
+
);
25
25
+
26
26
+
const markdownContent = micromark(content || "Coming soon.");
27
27
+
28
28
+
return (
29
29
+
<div
30
30
+
className="mt-4 w-full max-w-none prose prose-stone dark:prose-invert leading-relaxed"
31
31
+
dangerouslySetInnerHTML={{ __html: markdownContent }}
32
32
+
/>
33
33
+
);
34
34
+
}
+2
-3
components/pageContent/blog/BlogPostPage.tsx
···
1
1
import BaseLayout from "@/components/BaseLayout";
2
2
-
// import BlogPostContent from "@/components/BlogPostContent";
2
2
+
import BlogPostContent from "@/components/BlogPostContent";
3
3
import type BlogPostType from "@/types/BlogPost";
4
4
5
5
interface BlogPostProps {
···
12
12
return (
13
13
<BaseLayout titleText={`Blog | ${blogPost.title}`}>
14
14
<div className="max-w-3xl mx-auto">
15
15
-
{/* <BlogPostContent blogPost={blogPost} /> */}
16
16
-
{blogPost.title}
15
15
+
<BlogPostContent blogPost={blogPost} />
17
16
</div>
18
17
</BaseLayout>
19
18
);