infra for multiple sources in Card

This commit is contained in:
Lachlan Kermode
2018-12-13 17:47:35 +00:00
parent c85b0c9001
commit cccbcb9e54
2 changed files with 13 additions and 7 deletions

View File

@@ -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 ? (
<div><small>{source.error}</small></div>
) : (
@@ -15,7 +15,11 @@ const CardSource = ({ source, language, isLoading, error }) => {
}
function renderContent() {
return isLoading ? <Spinner/> : renderSource()
return isLoading
? <Spinner/>
: sources.map(
source => renderSource(source)
)
}
return (