mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 05:18:34 +03:00
render sources collectively in card
This commit is contained in:
@@ -3,28 +3,28 @@ import Spinner from './Spinner'
|
||||
|
||||
import copy from '../../js/data/copy.json'
|
||||
|
||||
function renderSource(source) {
|
||||
return source.error ? (
|
||||
<div><small>{source.error}</small></div>
|
||||
) : (
|
||||
<div>
|
||||
<p>{source.id}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const CardSource = ({ source, language, isLoading, error }) => {
|
||||
const source_lang = copy[language].cardstack.source
|
||||
|
||||
function renderContent() {
|
||||
return isLoading
|
||||
? <Spinner/>
|
||||
: renderSource(source)
|
||||
if (isLoading) {
|
||||
return <Spinner/>
|
||||
} else if (source.error) {
|
||||
return (
|
||||
<div><small>{source.error}</small></div>
|
||||
)
|
||||
} else {
|
||||
/* source with no errors */
|
||||
return (
|
||||
<div>
|
||||
<p>{source.id}</p>
|
||||
<i className="material-icons md-36">photo</i>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="card-row card-cell source">
|
||||
<h4>{source_lang}: </h4>
|
||||
{renderContent()}
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user