File tree Expand file tree Collapse file tree 2 files changed +50
-24
lines changed
packages/gatsby-theme/src Expand file tree Collapse file tree 2 files changed +50
-24
lines changed 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
26
+ width = { [ 1 ] }
27
+ p = { 4 }
28
+ my = { 4 }
29
+ borderRadius = { 8 }
30
+ boxShadow = "small"
31
+ key = { tutorial . id }
32
+ >
33
+ < Link to = { getTutorialOverviewSlug ( tutorial . fileAbsolutePath ) } >
34
+ < Heading > { tutorial . frontmatter . tutorialTitle } </ Heading >
35
+ </ Link >
36
+ < Text > { tutorial . frontmatter . description } </ Text >
37
+ </ Card >
38
+ ) ;
39
+ } ;
40
+
41
+ export default TutorialListing ;
Original file line number Diff line number Diff line change 1
1
import * as React from 'react' ;
2
2
import Layout from '../components/layout' ;
3
- import { Content } from '../shared/styledHelpers' ;
3
+ import { Content } from '../components/ shared/styledHelpers' ;
4
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' ;
5
+ import TutorialListing from '../components/TutorialListing' ;
6
+ import { Heading } from '../components/shared/base' ;
8
7
9
8
const Community = data => {
10
- console . log ( data ) ;
11
- console . log ( data . data . tutorials . edges ) ;
12
9
const tutorials = data . data . tutorials . edges ;
13
10
return (
14
11
< 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
- } ) }
12
+ < Content >
13
+ < Heading > Community Tutorials </ Heading >
14
+ { tutorials . map ( tutorial => {
15
+ return < TutorialListing tutorial = { tutorial . node } /> ;
16
+ } ) }
17
+ </ Content >
33
18
</ Layout >
34
19
) ;
35
20
} ;
You can’t perform that action at this time.
0 commit comments