From cccbcb9e5456464cb971a13286bc998c1b486413 Mon Sep 17 00:00:00 2001 From: Lachlan Kermode Date: Thu, 13 Dec 2018 17:47:35 +0000 Subject: [PATCH] infra for multiple sources in Card --- src/components/Card.jsx | 10 ++++++---- src/components/presentational/CardSource.js | 10 +++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/components/Card.jsx b/src/components/Card.jsx index 520b7b9..25e2d01 100644 --- a/src/components/Card.jsx +++ b/src/components/Card.jsx @@ -91,10 +91,12 @@ class Card extends React.Component { ({ + ...s, + error: this.props.sourceError + })), + ]} /> ) } diff --git a/src/components/presentational/CardSource.js b/src/components/presentational/CardSource.js index 95fdb06..9033877 100644 --- a/src/components/presentational/CardSource.js +++ b/src/components/presentational/CardSource.js @@ -3,10 +3,10 @@ import Spinner from './Spinner' import copy from '../../js/data/copy.json' -const CardSource = ({ source, language, isLoading, error }) => { +const CardSource = ({ sources, language, isLoading, error }) => { const source_lang = copy[language].cardstack.source - function renderSource() { + function renderSource(source) { return source.error ? (
{source.error}
) : ( @@ -15,7 +15,11 @@ const CardSource = ({ source, language, isLoading, error }) => { } function renderContent() { - return isLoading ? : renderSource() + return isLoading + ? + : sources.map( + source => renderSource(source) + ) } return (