-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblog-front-page.js
45 lines (43 loc) · 1.28 KB
/
blog-front-page.js
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
import React from 'react';
import {graphql, useStaticQuery} from 'gatsby';
import PostCardFront from "./post-card-front";
import {Col, Container, Row} from 'react-bootstrap';
const query = graphql`
{
allMarkdownRemark(
sort: {frontmatter: {date: DESC}}
limit: 3
filter: {frontmatter: {type: {eq: "post"}}}
) {
edges {
node {
frontmatter {
permalink
title
id
date(formatString: "MMMM DD, YYYY")
}
id
excerpt
}
}
}
}
`;
const LatestPosts = () => {
const data = useStaticQuery(query);
const posts = data.allMarkdownRemark.edges;
return (
<Container>
<h2 className={'display-3 text-center display-6 fw-bold'}>Latest news and events</h2>
<Col md={12} className={'text-center'}>
<Row className={"my-4 bg-white"}>
{posts.map(({node}) => (
<PostCardFront key={node.id} post={node}/>
))}
</Row>
</Col>
</Container>
);
};
export default LatestPosts;