From bbd7cd21619c97748723f7080a01768fc3a202c1 Mon Sep 17 00:00:00 2001 From: shmck Date: Sat, 21 Mar 2020 16:25:18 -0700 Subject: [PATCH] add author to tutorial list --- .../src/containers/SelectTutorial/SelectTutorial.tsx | 1 + web-app/src/containers/SelectTutorial/TutorialItem.tsx | 10 ++++++---- web-app/stories/SelectTutorial.stories.tsx | 7 +++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/web-app/src/containers/SelectTutorial/SelectTutorial.tsx b/web-app/src/containers/SelectTutorial/SelectTutorial.tsx index adc57c97..55566abc 100644 --- a/web-app/src/containers/SelectTutorial/SelectTutorial.tsx +++ b/web-app/src/containers/SelectTutorial/SelectTutorial.tsx @@ -42,6 +42,7 @@ const SelectTutorial = (props: Props) => { onSelect={() => onSelect(tutorial)} title={tutorial.summary.title || ''} description={tutorial.summary.description || ''} + createdBy={tutorial.createdBy} /> ))} diff --git a/web-app/src/containers/SelectTutorial/TutorialItem.tsx b/web-app/src/containers/SelectTutorial/TutorialItem.tsx index ebbef0c7..898ac09f 100644 --- a/web-app/src/containers/SelectTutorial/TutorialItem.tsx +++ b/web-app/src/containers/SelectTutorial/TutorialItem.tsx @@ -1,4 +1,5 @@ import * as React from 'react' +import * as G from 'typings/graphql' import { css, jsx } from '@emotion/core' import Card from '../../components/Card' import Tag from '../../components/Tag' @@ -46,8 +47,9 @@ const styles = { } interface Props { - title?: string - description?: string + title: string + description: string + createdBy?: G.User | null onSelect(): void } @@ -69,8 +71,8 @@ const TutorialItem = (props: Props) => (
-

{props.title || 'Title'}

-

Author Name

+

{props.title}

+ {props.createdBy &&

{props.createdBy.name}

}
javascript
diff --git a/web-app/stories/SelectTutorial.stories.tsx b/web-app/stories/SelectTutorial.stories.tsx index 23582c0d..26b4d7b4 100644 --- a/web-app/stories/SelectTutorial.stories.tsx +++ b/web-app/stories/SelectTutorial.stories.tsx @@ -12,6 +12,9 @@ const tutorialList = [ title: 'Tutorial 1', description: 'The first one', }, + createdBy: { + name: 'First Lastname', + }, }, { id: '2', @@ -19,6 +22,9 @@ const tutorialList = [ title: 'Tutorial 2', description: 'The second one', }, + createdBy: { + name: 'Joe Schmo', + }, }, ] @@ -34,6 +40,7 @@ storiesOf('Select Tutorial', module) onSelect={action('onSelect')} title={tutorial.summary.title} description={tutorial.summary.description} + createdBy={{ name: 'First Lastname' }} /> ) })