refmt CardSource

This commit is contained in:
Lachlan Kermode
2018-12-11 11:39:43 +00:00
parent ab20d962ad
commit 50d8058366

View File

@@ -6,24 +6,22 @@ import copy from '../../js/data/copy.json'
const CardSource = ({ source, language, isLoading, error }) => {
const source_lang = copy[language].cardstack.source
if (isLoading) {
return <Spinner />
}
function renderSource() {
return (
return source.error ? (
<div><small>{source.error}</small></div>
) : (
<div><p>TODO: display source properly.</p></div>
)
}
function renderContent() {
return isLoading ? <Spinner/> : renderSource()
}
return (
<div className="card-col card-cell source">
<h4>{source_lang}: </h4>
{source.error ? (
<div><small>{source.error}</small></div>
) : (
renderSource()
)}
{renderContent()}
</div>
)
}