factor sources map to Card from CardSource

This commit is contained in:
Lachlan Kermode
2018-12-13 17:53:13 +00:00
parent cccbcb9e54
commit 7267f821ab
2 changed files with 18 additions and 22 deletions

View File

@@ -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 ? (
<div><small>{source.error}</small></div>
) : (
<div><p>TODO: display source properly.</p></div>
)
}
function renderSource(source) {
return source.error ? (
<div><small>{source.error}</small></div>
) : (
<div><p>TODO: display source properly.</p></div>
)
}
const CardSource = ({ source, language, isLoading, error }) => {
const source_lang = copy[language].cardstack.source
function renderContent() {
return isLoading
? <Spinner/>
: sources.map(
source => renderSource(source)
)
: renderSource(source)
}
return (