Skip to content

Commit 3ec30ca

Browse files
committed
/curation/ now looks like the numbered page
It uses duplicate code, which sucks. I should figure out how to deduplicate the code.
1 parent ed3ae4d commit 3ec30ca

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

src/pages/curation/index.astro

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,33 @@
11
---
22
import {render} from "astro:content";
33
4-
import Layout from "./_layouts/CurationBaseLayout.astro";
54
import {fm} from "@helpers/frontmatter";
6-
5+
import PaginationNavigatorBar from "@components/PaginationNavigatorBar";
76
import {getCurationCollectionPaginated} from "@helpers/collections/curation";
87
8+
import Layout from "./_layouts/CurationBaseLayout.astro";
9+
910
import "./_index.css";
1011
1112
const groups = (await getCurationCollectionPaginated()).groups;
1213
const posts = groups[0];
1314
if (!posts) throw new Error();
1415
16+
const mockedPage = {
17+
currentPage: 1,
18+
lastPage: groups.length,
19+
url: {
20+
current: "/curation/",
21+
prev: undefined,
22+
next: "/curation/2/",
23+
first: undefined,
24+
last: `/curation/${groups.length}/`,
25+
},
26+
};
27+
function numToURL(i: number): string {
28+
return `/curation/${i}/`;
29+
}
30+
1531
export const frontmatter = fm({
1632
title: "Sim's Internet Curation",
1733
description: "A hand-curated feed of internet content.",
@@ -24,9 +40,10 @@ export const frontmatter = fm({
2440
<div id="welcome">
2541
<p><a href="./about/">About This Page</a></p>
2642
<p><em>Disclaimer: Posts shown here or any commentary I write may contain factual errors or imbalanced representation.</em></p>
27-
<p><a href="./2/">Next Page</a></p>
2843
</div>
2944

45+
<PaginationNavigatorBar page={mockedPage} numberToURL={numToURL}/>
46+
3047
{posts.map(async (p) => {
3148
const renderedContent = await (async ()=>{
3249
if (!p.collectionEntry) return null;
@@ -47,6 +64,8 @@ export const frontmatter = fm({
4764
</article>
4865
})}
4966

67+
<PaginationNavigatorBar page={mockedPage} numberToURL={numToURL}/>
68+
5069

5170
</Layout>
5271

0 commit comments

Comments
 (0)