-
-
Notifications
You must be signed in to change notification settings - Fork 769
/
Copy pathall-blog-posts.tsx
51 lines (47 loc) · 1.19 KB
/
all-blog-posts.tsx
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
42
43
44
45
46
47
48
49
50
51
import { graphql } from "gatsby";
import React, { FC } from "react";
import { ContentSection, Pagination } from "@/components/misc";
import { AllBlogPostsFragment } from "@/graphql-types";
import { BlogArticleTeaser } from "./blog-article-teaser";
import { Boxes } from "./box-elements";
export interface AllBlogPostsProps {
readonly data: AllBlogPostsFragment;
readonly description: string;
readonly currentPage: number;
readonly totalPages: number;
readonly basePath: string;
}
export const AllBlogPosts: FC<AllBlogPostsProps> = ({
data: { edges },
description,
currentPage,
totalPages,
basePath,
}) => {
return (
<>
<ContentSection title="Blog" text={description} noBackground>
<Boxes>
{edges.map(({ node }) => (
<BlogArticleTeaser key={`article-${node.id}`} data={node} />
))}
</Boxes>
</ContentSection>
<Pagination
currentPage={currentPage}
linkPrefix={basePath}
totalPages={totalPages}
/>
</>
);
};
export const BlogArticlesGraphQLFragment = graphql`
fragment AllBlogPosts on MdxConnection {
edges {
node {
id
...BlogArticleTeaser
}
}
}
`;