mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 13:28:36 +03:00
infra for multiple sources in Card
This commit is contained in:
@@ -91,10 +91,12 @@ class Card extends React.Component {
|
||||
<CardSource
|
||||
isLoading={this.props.isLoading}
|
||||
language={this.props.language}
|
||||
source={{
|
||||
...this.props.source,
|
||||
error: this.props.sourceError
|
||||
}}
|
||||
sources={[
|
||||
...this.props.event.sources.map(s => ({
|
||||
...s,
|
||||
error: this.props.sourceError
|
||||
})),
|
||||
]}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user