Skip to content

Commit 9fa8a89

Browse files
committed
inital set up for community tutorial listing page
1 parent f625543 commit 9fa8a89

File tree

2 files changed

+66
-7
lines changed

2 files changed

+66
-7
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import * as React from 'react';
2+
import Layout from '../components/layout';
3+
import { Content } from '../shared/styledHelpers';
4+
import { graphql } from 'gatsby';
5+
import { Heading, Text, Card } from '../components/shared/base';
6+
import { getTutorialSlug } from '../utils/getTutorialSlug';
7+
import { Link } from 'gatsby';
8+
9+
const Community = data => {
10+
console.log(data);
11+
console.log(data.data.tutorials.edges);
12+
const tutorials = data.data.tutorials.edges;
13+
return (
14+
<Layout>
15+
<Heading> Community Tutorials </Heading>
16+
{tutorials.map(tutorial => {
17+
return (
18+
<Card
19+
width={[1]}
20+
p={4}
21+
my={4}
22+
borderRadius={8}
23+
boxShadow="small"
24+
key={tutorial.node.id}
25+
>
26+
<Link to={getTutorialSlug(tutorial.node.fileAbsolutePath)}>
27+
<Heading>{tutorial.node.frontmatter.tutorialTitle}</Heading>
28+
</Link>
29+
<Text>{tutorial.node.frontmatter.description}</Text>
30+
</Card>
31+
);
32+
})}
33+
</Layout>
34+
);
35+
};
36+
37+
export const query = graphql`
38+
query CommunityTutorialQuery {
39+
tutorials: allMdx(
40+
filter: {
41+
frontmatter: { tutorialTitle: { ne: null } }
42+
fileAbsolutePath: { regex: "/community/" }
43+
}
44+
) {
45+
edges {
46+
node {
47+
id
48+
fileAbsolutePath
49+
frontmatter {
50+
tutorialTitle
51+
description
52+
}
53+
}
54+
}
55+
}
56+
}
57+
`;
58+
59+
export default Community;

packages/gatsby-theme/src/pages/components.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Link } from "gatsby";
2-
import * as React from "react";
3-
import Layout from "../components/layout";
1+
import { Link } from 'gatsby';
2+
import * as React from 'react';
3+
import Layout from '../components/layout';
44
import {
55
Box,
66
Flex,
@@ -9,10 +9,10 @@ import {
99
Button,
1010
Image,
1111
Card,
12-
Link as BaseLink
13-
} from "../components/shared/base";
12+
Link as BaseLink,
13+
} from '../components/shared/base';
1414

15-
const SecondPage = () => (
15+
const Components = () => (
1616
<Layout>
1717
<h3>Check out our rebass components!</h3>
1818

@@ -65,4 +65,4 @@ const SecondPage = () => (
6565
</Layout>
6666
);
6767

68-
export default SecondPage;
68+
export default Components;

0 commit comments

Comments
 (0)