@@ -7,31 +7,24 @@ import UpvoteMutation from './UpvoteMutation';
77import BookmarkMutation from './BookmarkMutation' ;
88import ProgressBanner from './ProgressBanner' ;
99import { getTutorialbyGatsbyID } from '../../utils/queries' ;
10+ import { GetTutorialbyGatsbyIdQuery , Mdx } from '../../graphqlTypes' ;
1011
1112type TutorialListingProps = {
12- tutorial : Tutorial ;
13- } ;
14-
15- type Tutorial = {
16- id : string ;
17- fileAbsolutePath : string ;
18- frontmatter : FrontMatter ;
19- } ;
20-
21- type FrontMatter = {
22- id : string ;
23- tutorialTitle : string ;
24- description : string ;
13+ tutorial : Mdx ;
2514} ;
2615
2716const TutorialListing : React . FunctionComponent < TutorialListingProps > = ( {
2817 tutorial,
2918} ) => {
30- const gatsbyID = tutorial . frontmatter . id ;
31- let tutorialPath = getTutorialOverviewSlug ( tutorial . fileAbsolutePath ) ;
19+ const gatsbyID = tutorial ! . frontmatter ! . id ;
20+ let tutorialPath = getTutorialOverviewSlug ( tutorial ! . fileAbsolutePath ) ;
3221 return (
33- < Query query = { getTutorialbyGatsbyID } variables = { { gatsbyID : gatsbyID } } >
22+ < Query < GetTutorialbyGatsbyIdQuery >
23+ query = { getTutorialbyGatsbyID }
24+ variables = { { gatsbyID : gatsbyID } }
25+ >
3426 { ( { data } ) => {
27+ const gatsbyTutorial = data ! . getTutorialbyGatsbyID ;
3528 return (
3629 < Card
3730 width = { [ 1 ] }
@@ -43,20 +36,19 @@ const TutorialListing: React.FunctionComponent<TutorialListingProps> = ({
4336 >
4437 < Flex alignItems = "center" justifyContent = "center" >
4538 < Box width = { 1 / 12 } >
46- { data . getTutorialbyGatsbyID && (
39+ { gatsbyTutorial && (
4740 < div >
48- < UpvoteMutation tutorial = { data . getTutorialbyGatsbyID } />
49- < BookmarkMutation tutorial = { data . getTutorialbyGatsbyID } />
50- < ProgressBanner tutorial = { data . getTutorialbyGatsbyID } />
41+ < UpvoteMutation tutorial = { gatsbyTutorial } />
42+ < BookmarkMutation tutorial = { gatsbyTutorial } />
43+ < ProgressBanner tutorial = { gatsbyTutorial } />
5144 </ div >
5245 ) }
5346 </ Box >
54-
5547 < Box width = { 11 / 12 } >
5648 < Link to = { tutorialPath } >
57- < Heading > { tutorial . frontmatter . tutorialTitle } </ Heading >
49+ < Heading > { tutorial ! . frontmatter ! . tutorialTitle } </ Heading >
5850 </ Link >
59- < Text > { tutorial . frontmatter . description } </ Text >
51+ < Text > { tutorial ! . frontmatter ! . description } </ Text >
6052 </ Box >
6153 </ Flex >
6254 </ Card >
0 commit comments