-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathpage.tsx
More file actions
41 lines (32 loc) · 911 Bytes
/
page.tsx
File metadata and controls
41 lines (32 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import MoreContent from "@/components/more-content";
import type { DocCountResult } from "@/sanity/types";
import { sanityFetch } from "@/sanity/lib/live";
import PaginateList from "@/components/paginate-list";
import { docCount } from "@/sanity/lib/queries";
const LIMIT = 10;
type Params = Promise<{ num: string }>;
export default async function Page({ params }: { params: Params }) {
const { num } = await params;
const count = (
await sanityFetch({
query: docCount,
params: {
type: "author",
},
})
).data as DocCountResult;
const pageNumber = Number(num);
const offset = (pageNumber - 1) * LIMIT;
const limit = offset + LIMIT;
return (
<div className="container px-5 mx-auto mb-32">
<MoreContent type="author" limit={limit} offset={offset} showHeader />
<PaginateList
base="authors"
num={Number(num)}
limit={LIMIT}
count={count}
/>
</div>
);
}