File tree Expand file tree Collapse file tree 7 files changed +132
-18
lines changed
packages/gatsby-theme/src Expand file tree Collapse file tree 7 files changed +132
-18
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
+ import { getTutorialSlug } from '../utils/getTutorialSlug' ;
3
+ import { Link } from 'gatsby' ;
2
4
import { Heading , Text , Flex , Card } from './shared/base' ;
3
5
4
6
type ChapterProps = {
5
7
num : string | number ;
6
- title : string | null ;
7
- description : string | null ;
8
+ tutorial : Tutorial ;
9
+ } ;
10
+
11
+ type Tutorial = {
12
+ id : string ;
13
+ fileAbsolutePath : string ;
14
+ frontmatter : FrontMatter ;
8
15
} ;
9
16
17
+ type FrontMatter = {
18
+ pageTitle : string | null ;
19
+ description : string | null ;
20
+ }
21
+
10
22
const Chapter : React . FunctionComponent < ChapterProps > = ( {
11
- num,
12
- title,
13
- description,
23
+ num, tutorial
14
24
} ) => {
15
25
return (
16
26
< Card width = { [ 1 ] } p = { 4 } my = { 4 } borderRadius = { 8 } boxShadow = "small" >
17
27
< Flex alignItems = "center" >
18
28
< Heading p = { 4 } > { num } </ Heading >
19
29
< div >
20
- < Heading as = "h2" > { title } </ Heading >
21
- < Text > { description } </ Text >
30
+ < Link to = { getTutorialSlug ( tutorial . fileAbsolutePath ) } >
31
+ < Heading as = "h2" > { tutorial . frontmatter . pageTitle } </ Heading >
32
+ </ Link >
33
+ < Text > { tutorial . frontmatter . description } </ Text >
34
+
22
35
</ div >
23
36
</ Flex >
24
37
</ Card >
Original file line number Diff line number Diff line change
1
+ import * as React from 'react' ;
2
+ import { Heading , Text , Card } from './shared/base' ;
3
+ import { getTutorialOverviewSlug } from '../utils/getTutorialSlug' ;
4
+ import { Link } from 'gatsby' ;
5
+
6
+ type TutorialListingProps = {
7
+ tutorial : Tutorial ;
8
+ } ;
9
+
10
+ type Tutorial = {
11
+ id : string ;
12
+ fileAbsolutePath : string ;
13
+ frontmatter : FrontMatter ;
14
+ } ;
15
+
16
+ type FrontMatter = {
17
+ tutorialTitle : string ;
18
+ description : string ;
19
+ } ;
20
+
21
+ const TutorialListing : React . FunctionComponent < TutorialListingProps > = ( {
22
+ tutorial,
23
+ } ) => {
24
+ return (
25
+ < Card width = { [ 1 ] } p = { 4 } my = { 4 } borderRadius = { 8 } boxShadow = "small" >
26
+ < Link to = { getTutorialOverviewSlug ( tutorial . fileAbsolutePath ) } >
27
+ < Heading > { tutorial . frontmatter . tutorialTitle } </ Heading >
28
+ </ Link >
29
+ < Text > { tutorial . frontmatter . description } </ Text >
30
+ </ Card >
31
+ ) ;
32
+ } ;
33
+
34
+ export default TutorialListing ;
Original file line number Diff line number Diff line change @@ -51,8 +51,8 @@ const Nav = withTheme(
51
51
</ Container >
52
52
< Container justifyContent = "center" >
53
53
< NavLink to = "/fundamentals" > Fundamentals</ NavLink >
54
- < NavLink to = "/guides" > Guides </ NavLink >
55
- < NavLink to = "/community" > Community</ NavLink >
54
+ < NavLink to = "/courses" > FullStack Course </ NavLink >
55
+ < NavLink to = "/community" > Community Tutorials </ NavLink >
56
56
< NavLink to = "/components" > Components</ NavLink >
57
57
</ Container >
58
58
< Container justifyContent = "flex-end" >
Original file line number Diff line number Diff line change @@ -48,8 +48,7 @@ const PageTemplate: React.FunctionComponent<PageTemplateProps> = ({ data }) => {
48
48
< div >
49
49
< Chapter
50
50
num = { num < 10 ? `0${ num } ` : num }
51
- title = { mdx . node . frontmatter ! . pageTitle }
52
- description = { mdx . node . frontmatter ! . description }
51
+ tutorial = { mdx . node }
53
52
/>
54
53
</ div >
55
54
) ;
@@ -73,6 +72,7 @@ export const query = graphql`
73
72
edges {
74
73
node {
75
74
id
75
+ fileAbsolutePath
76
76
frontmatter {
77
77
pageTitle
78
78
description
Original file line number Diff line number Diff line change
1
+ import * as React from 'react' ;
2
+ import Layout from '../components/layout' ;
3
+ import { Content } from '../components/shared/styledHelpers' ;
4
+ import { graphql } from 'gatsby' ;
5
+ import TutorialListing from '../components/TutorialListing' ;
6
+ import { Heading } from '../components/shared/base' ;
7
+
8
+ const Community = data => {
9
+ const tutorials = data . data . tutorials . edges ;
10
+ return (
11
+ < Layout >
12
+ < Content >
13
+ < Heading > Community Tutorials </ Heading >
14
+ { tutorials . map ( tutorial => {
15
+ return (
16
+ < div key = { tutorial . node . id } >
17
+ < TutorialListing tutorial = { tutorial . node } />
18
+ </ div >
19
+ ) ;
20
+ } ) }
21
+ </ Content >
22
+ </ Layout >
23
+ ) ;
24
+ } ;
25
+
26
+ export const query = graphql `
27
+ query CommunityTutorialQuery {
28
+ tutorials: allMdx(
29
+ filter: {
30
+ frontmatter: { tutorialTitle: { ne: null } }
31
+ fileAbsolutePath: { regex: "/community/" }
32
+ }
33
+ ) {
34
+ edges {
35
+ node {
36
+ id
37
+ fileAbsolutePath
38
+ frontmatter {
39
+ tutorialTitle
40
+ description
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ ` ;
47
+
48
+ export default Community ;
Original file line number Diff line number Diff line change 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' ;
4
4
import {
5
5
Box ,
6
6
Flex ,
@@ -9,10 +9,10 @@ import {
9
9
Button ,
10
10
Image ,
11
11
Card ,
12
- Link as BaseLink
13
- } from " ../components/shared/base" ;
12
+ Link as BaseLink ,
13
+ } from ' ../components/shared/base' ;
14
14
15
- const SecondPage = ( ) => (
15
+ const Components = ( ) => (
16
16
< Layout >
17
17
< h3 > Check out our rebass components!</ h3 >
18
18
@@ -65,4 +65,4 @@ const SecondPage = () => (
65
65
</ Layout >
66
66
) ;
67
67
68
- export default SecondPage ;
68
+ export default Components ;
Original file line number Diff line number Diff line change
1
+ import * as React from 'react' ;
2
+ import Layout from '../components/layout' ;
3
+ import { Content } from '../components/shared/styledHelpers' ;
4
+ import { Heading , Text } from '../components/shared/base' ;
5
+
6
+ const courses = ( ) => {
7
+ return (
8
+ < Layout >
9
+ < Content >
10
+ < Heading > Fullstack Course </ Heading >
11
+ < Text > A general introduction to GraphQL for frontend and backend developers.</ Text >
12
+ < Text > Read this tutorial to learn about GraphQL's basic concepts and prepare
13
+ yourself for a hands-on beginner tutorial.</ Text >
14
+ </ Content >
15
+ </ Layout >
16
+ ) ;
17
+ } ;
18
+
19
+ export default courses ;
You can’t perform that action at this time.
0 commit comments