diff --git a/src/components/Card.jsx b/src/components/Card.jsx index 25e2d01..b85a144 100644 --- a/src/components/Card.jsx +++ b/src/components/Card.jsx @@ -86,19 +86,17 @@ class Card extends React.Component { ) } - renderSource() { - return ( + renderSources() { + return this.props.event.sources.map(source => ( ({ - ...s, - error: this.props.sourceError - })), - ]} + source={{ + ...source, + error: this.props.sourceError + }} /> - ) + )) } // NB: should be internaionalized. @@ -147,7 +145,7 @@ class Card extends React.Component { return (
{this.renderTags()} - {this.renderSource()} + {this.renderSources()} {this.renderNarrative()}
) diff --git a/src/components/presentational/CardSource.js b/src/components/presentational/CardSource.js index 9033877..4213abc 100644 --- a/src/components/presentational/CardSource.js +++ b/src/components/presentational/CardSource.js @@ -3,23 +3,21 @@ import Spinner from './Spinner' import copy from '../../js/data/copy.json' -const CardSource = ({ sources, language, isLoading, error }) => { - const source_lang = copy[language].cardstack.source +function renderSource(source) { + return source.error ? ( +
{source.error}
+ ) : ( +

TODO: display source properly.

+ ) +} - function renderSource(source) { - return source.error ? ( -
{source.error}
- ) : ( -

TODO: display source properly.

- ) - } +const CardSource = ({ source, language, isLoading, error }) => { + const source_lang = copy[language].cardstack.source function renderContent() { return isLoading ? - : sources.map( - source => renderSource(source) - ) + : renderSource(source) } return (