mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 13:28:36 +03:00
Additional card cleanup
This commit is contained in:
18
src/components/presentational/CardCaret.js
Normal file
18
src/components/presentational/CardCaret.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import React from 'react';
|
||||
|
||||
const CardCaret = ({ isHighlighted, toggle }) => {
|
||||
|
||||
let classes = (isHighlighted)
|
||||
? 'arrow-down'
|
||||
: 'arrow-down folded';
|
||||
|
||||
return (
|
||||
<div className="card-toggle" onClick={toggle}>
|
||||
<p>
|
||||
<i className={classes}></i>
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default CardCaret;
|
||||
13
src/components/presentational/CardCategory.js
Normal file
13
src/components/presentational/CardCategory.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import React from 'react';
|
||||
|
||||
const CardCategory = ({ categoryTitle, categoryLabel, colorType }) => (
|
||||
<div className="event-card-section category">
|
||||
<h4>{categoryTitle}</h4>
|
||||
<p>
|
||||
<span className={`color-category ${colorType}`}/>
|
||||
{categoryLabel}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
export default CardCategory;
|
||||
26
src/components/presentational/CardLocation.js
Normal file
26
src/components/presentational/CardLocation.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import React from 'react';
|
||||
|
||||
import copy from '../../js/data/copy.json';
|
||||
import {isNotNullNorUndefined} from '../../js/data/utilities';
|
||||
|
||||
const CardLocation = ({ language, location }) => {
|
||||
|
||||
const location_lang = copy[language].cardstack.location;
|
||||
if (isNotNullNorUndefined(location)) {
|
||||
return (
|
||||
<p className="event-card-section location">
|
||||
<h4>{location_lang}</h4>
|
||||
<p>{location}</p>
|
||||
</p>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<p className="event-card-section location">
|
||||
<h4>{location_lang}</h4>
|
||||
<p>Sin localización conocida.</p>
|
||||
</p>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default CardLocation;
|
||||
13
src/components/presentational/CardNarrative.js
Normal file
13
src/components/presentational/CardNarrative.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import React from 'react';
|
||||
|
||||
import CardNarrativeLink from './CardNarrativeLink';
|
||||
|
||||
const CardNarrative = (props) => (
|
||||
<div className="event-card-section">
|
||||
<h4>Connected events</h4>
|
||||
<p>Next: <CardNarrativeLink {...props} event={props.next}/></p>
|
||||
<p>Previous: <CardNarrativeLink {...props} event={props.prev} /></p>
|
||||
</div>
|
||||
);
|
||||
|
||||
export default CardNarrative;
|
||||
17
src/components/presentational/CardNarrativeLink.js
Normal file
17
src/components/presentational/CardNarrativeLink.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import React from 'react';
|
||||
|
||||
const CardNarrativeLink = ({ event, makeTimelabel, select }) => {
|
||||
if (event !== null) {
|
||||
const timelabel = makeTimelabel(event.timestamp);
|
||||
|
||||
return (
|
||||
<a onClick={() => select(event)}>
|
||||
{`${timelabel} - ${event.location}`}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
return (<a className="disabled">None</a>);
|
||||
}
|
||||
|
||||
export default CardNarrativeLink;
|
||||
16
src/components/presentational/CardSource.js
Normal file
16
src/components/presentational/CardSource.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import React from 'react';
|
||||
|
||||
import copy from '../../js/data/copy.json';
|
||||
|
||||
const CardSource = ({ source, language }) => {
|
||||
const source_lang = copy[language].cardstack.source;
|
||||
|
||||
return (
|
||||
<div className="event-card-section source">
|
||||
<h4>{source_lang}</h4>
|
||||
<p>{source}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default CardSource;
|
||||
18
src/components/presentational/CardSummary.js
Normal file
18
src/components/presentational/CardSummary.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import React from 'react';
|
||||
|
||||
import copy from '../../js/data/copy.json';
|
||||
|
||||
const CardSummary = ({ language, description, isHighlighted }) => {
|
||||
|
||||
const summary = copy[language].cardstack.description;
|
||||
const descriptionText = (isHighlighted) ? description : `${description.substring(0, 40)}...`;
|
||||
|
||||
return (
|
||||
<div className="event-card-section summary">
|
||||
<h4>{summary}</h4>
|
||||
<p>{descriptionText}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default CardSummary;
|
||||
29
src/components/presentational/CardTags.js
Normal file
29
src/components/presentational/CardTags.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import React from 'react';
|
||||
|
||||
import copy from '../../js/data/copy.json';
|
||||
|
||||
const CardTags = ({ tags, language }) => {
|
||||
const label = copy[language].cardstack.people;
|
||||
|
||||
return (
|
||||
<div className="event-card-section tags">
|
||||
<h4>{label}</h4>
|
||||
<p>{
|
||||
tags.map((tag, idx) => {
|
||||
return (
|
||||
<span className="tag">
|
||||
{tag.name}
|
||||
{
|
||||
(idx < tags.length - 1)
|
||||
? ','
|
||||
: ''
|
||||
}
|
||||
</span>
|
||||
);
|
||||
})
|
||||
}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default CardTags;
|
||||
30
src/components/presentational/CardTimestamp.js
Normal file
30
src/components/presentational/CardTimestamp.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import React from 'react';
|
||||
|
||||
import copy from '../../js/data/copy.json';
|
||||
import {isNotNullNorUndefined} from '../../js/data/utilities';
|
||||
|
||||
const CardTimestamp = ({ makeTimelabel, language, timestamp }) => {
|
||||
|
||||
const daytime_lang = copy[language].cardstack.timestamp;
|
||||
const estimated_lang = copy[language].cardstack.estimated;
|
||||
const unknown_lang = copy[language].cardstack.unknown_time;
|
||||
|
||||
if (isNotNullNorUndefined(timestamp)) {
|
||||
const timelabel = makeTimelabel(timestamp);
|
||||
return (
|
||||
<div className="event-card-section timestamp">
|
||||
<h4>{daytime_lang}</h4>
|
||||
{timelabel}
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<div className="event-card-section timestamp">
|
||||
<h4>{daytime_lang}</h4>
|
||||
{unknown_lang}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default CardTimestamp;
|
||||
10
src/components/presentational/Checkbox.jsx
Normal file
10
src/components/presentational/Checkbox.jsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import React from 'react';
|
||||
|
||||
export default ({ label, isActive, onClickCheckbox }) => (
|
||||
<div className={(isActive) ? 'item active' : 'item'}>
|
||||
<span onClick={() => onClickCheckbox()}>{label}</span>
|
||||
<button onClick={() => onClickCheckbox()}>
|
||||
<div className="checkbox" />
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
12
src/components/presentational/Spinner.js
Normal file
12
src/components/presentational/Spinner.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import React from 'react';
|
||||
|
||||
const Spinner = ({}) => {
|
||||
return (
|
||||
<div className="spinner">
|
||||
<div className="double-bounce1"></div>
|
||||
<div className="double-bounce2"></div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Spinner;
|
||||
Reference in New Issue
Block a user