Skip to content

Commit c5db7c2

Browse files
committed
Move components out from pages to components/blog
1 parent 7584608 commit c5db7c2

File tree

3 files changed

+42
-40
lines changed

3 files changed

+42
-40
lines changed

components/blog/BlogHeader.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export function BlogHeader() {
2+
return (
3+
<div className="max-w-screen-lg mx-auto pt-4 pb-8 mb-16 border-b border-gray-400 border-opacity-20">
4+
<h1>
5+
<span className="font-bold leading-tight lg:text-5xl">Blog</span>
6+
</h1>
7+
<p className="text-center text-gray-500 dark:text-gray-400">
8+
The latest updates and releases from the team at Allo.
9+
</p>
10+
</div>
11+
);
12+
}

components/blog/BlogIndex.tsx

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import Link from "next/link";
2+
// eslint-disable-next-line import/no-unresolved
3+
import { getPagesUnderRoute } from "nextra/context";
4+
5+
export function BlogIndex() {
6+
return getPagesUnderRoute("/blog").map((page) => {
7+
return (
8+
<div key={page.route} className="mb-10">
9+
<Link
10+
href={page.route}
11+
style={{ color: "inherit", textDecoration: "none" }}
12+
className="block font-semibold mt-8 text-2xl"
13+
>
14+
{page.meta?.title || page.frontMatter?.title || page.name}
15+
</Link>
16+
<p className="opacity-80" style={{ marginTop: ".5rem" }}>
17+
{page.frontMatter?.description}{" "}
18+
<span className="inline-block">
19+
<Link href={page.route}>{"Read more →"}</Link>
20+
</span>
21+
</p>
22+
{page.frontMatter?.date ? (
23+
<p className="opacity-50 text-sm">{page.frontMatter.date}</p>
24+
) : null}
25+
</div>
26+
);
27+
});
28+
}

pages/blog.mdx

+2-40
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,8 @@ description: The latest updates and releases from the team at Allo.
33
type: posts
44
---
55

6-
import { getPagesUnderRoute } from "nextra/context";
7-
import Link from "next/link";
8-
9-
export function BlogHeader() {
10-
return (
11-
<div className="max-w-screen-lg mx-auto pt-4 pb-8 mb-16 border-b border-gray-400 border-opacity-20">
12-
<h1>
13-
<span className="font-bold leading-tight lg:text-5xl">Blog</span>
14-
</h1>
15-
<p className="text-center text-gray-500 dark:text-gray-400">
16-
The latest updates and releases from the team at Allo.
17-
</p>
18-
</div>
19-
);
20-
}
21-
22-
export function BlogIndex() {
23-
return getPagesUnderRoute("/blog").map((page) => {
24-
return (
25-
<div key={page.route} className="mb-10">
26-
<Link
27-
href={page.route}
28-
style={{ color: "inherit", textDecoration: "none" }}
29-
className="block font-semibold mt-8 text-2xl"
30-
>
31-
{page.meta?.title || page.frontMatter?.title || page.name}
32-
</Link>
33-
<p className="opacity-80" style={{ marginTop: ".5rem" }}>
34-
{page.frontMatter?.description}{" "}
35-
<span className="inline-block">
36-
<Link href={page.route}>{"Read more →"}</Link>
37-
</span>
38-
</p>
39-
{page.frontMatter?.date ? (
40-
<p className="opacity-50 text-sm">{page.frontMatter.date}</p>
41-
) : null}
42-
</div>
43-
);
44-
});
45-
}
6+
import { BlogHeader } from "../components/blog/BlogHeader";
7+
import { BlogIndex } from "../components/blog/BlogIndex";
468

479
<BlogHeader />
4810
<BlogIndex />

0 commit comments

Comments
 (0)