Conversation
src/app/components/Byline/index.tsx
Outdated
| case ARTICLE_PAGE: | ||
| return ( | ||
| <ArticleContributors | ||
| contributorValues={contributorValues} | ||
| isSingleContributor={isSingleContributor} | ||
| /> | ||
| ); | ||
| case MEDIA_ARTICLE_PAGE: | ||
| return ( | ||
| <ArticleContributors |
There was a problem hiding this comment.
As they are returning the same thing, should we combine the Article and Media Article cases here? Or have the response as the default?
There was a problem hiding this comment.
Good spot @emilysaffron
I've updated this to combine the Article Page & Media Article Page
scenarios as seen here.
The default scenario returns null to ensure we only render supported scenarios.
| <AuthorName | ||
| author={author} | ||
| authorName={authorName} | ||
| isSingleContributor |
There was a problem hiding this comment.
I think this needs to be isSingleContributor={isSingleContributor}
There was a problem hiding this comment.
isSingleContributor and isRtl are now being set correctly.
| </li> | ||
| {jobRole && ( | ||
| <li css={BylineCss.contributorTextWrapper}> | ||
| <AuthorRole jobRole={jobRole} role={role} isSingleContributor /> |
There was a problem hiding this comment.
I think this should be isSingleContributor={isSingleContributor}
There was a problem hiding this comment.
isSingleContributor and isRtl are now being set correctly.
| <AuthorLocation | ||
| location={location} | ||
| reportingFrom={reportingFrom} | ||
| isSingleContributor |
There was a problem hiding this comment.
And this isSingleContributor={isSingleContributor}
There was a problem hiding this comment.
isSingleContributor and isRtl are now being set correctly.
…/simorgh into WS-1985-render-byline-live-page-post
src/app/components/Byline/index.tsx
Outdated
|
|
||
| const Contributors = ({ contributorValues, isSingleContributor, pageType }) => { | ||
| switch (pageType) { | ||
| case ARTICLE_PAGE || MEDIA_ARTICLE_PAGE: |
There was a problem hiding this comment.
I see in a prior comment that was added, the case for ARTICLE_PAGE and MEDIA_ARTICLE_PAGE are the same, but currently this case statement will always go with ARTICLE_PAGE
| | returns the first truthy value, and since ARTICLE_PAGE is a string 'article' we will never reach MEDIA_ARTICLE_PAGE?
a pattern like this(used in the bylineExtractor):
case ARTICLE_PAGE:
case MEDIA_ARTICLE_PAGE:
case MEDIA_ASSET_PAGE:
case PHOTO_GALLERY_PAGE:
case STORY_PAGE:
return articlePageBylineExtractor(...);
would work well here!
There was a problem hiding this comment.
Thanks for catching this @Louis-Matsika. I've applied the
suggested approach here.
c508e15 to
7a42861
Compare
…/simorgh into WS-1985-render-byline-live-page-post
Resolves JIRA: WS-1985
Summary
Add a byline to Live Page posts
Code changes
NOTES
yarn test:dependenciesfails when the import format below is used hence the need for the// eslint-disable-next-line import/no-relative-packagesexclusions.Testing
Useful Links